Closed
Description
related to #3714
tz should not be settable
df=pd.DataFrame({"events":np.ones(len(dates))},index=motor["timestamps"].astype("datetime64[s]"))
df.describe()
events | |
---|---|
count | 2393 |
mean | 1 |
std | 0 |
min | 1 |
25% | 1 |
50% | 1 |
75% | 1 |
max | 1 |
df
<class 'pandas.core.frame.DataFrame'>
DatetimeIndex: 2393 entries, 2013-05-30 11:58:36 to 2013-06-03 13:30:43
Data columns (total 1 columns):
events 2393 non-null values
dtypes: float64(1)
df.index.tz='Asia/Kolkata'
df.index
<class 'pandas.tseries.index.DatetimeIndex'>
[2013-05-30 17:28:36, ..., 2013-06-03 19:00:43]
Length: 2393, Freq: None, Timezone: Asia/Kolkata
df2=df[df.index.day==3]
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-39-23de8e1402be> in <module>()
----> 1 df2=df[df.index.day==3]
/usr/local/lib/python2.7/dist-packages/pandas/tseries/index.pyc in f(self)
39 utc = _utc()
40 if self.tz is not utc:
---> 41 values = self._local_timestamps()
42 return tslib.get_date_field(values, field)
43 f.__name__ = name
/usr/local/lib/python2.7/dist-packages/pandas/tseries/index.pyc in _local_timestamps(self)
399 values = self.asi8
400 indexer = values.argsort()
--> 401 result = tslib.tz_convert(values.take(indexer), utc, self.tz)
402
403 n = len(indexer)
/usr/local/lib/python2.7/dist-packages/pandas/tslib.so in pandas.tslib.tz_convert (pandas/tslib.c:20949)()
/usr/local/lib/python2.7/dist-packages/pandas/tslib.so in pandas.tslib._get_deltas (pandas/tslib.c:22754)()
/usr/local/lib/python2.7/dist-packages/pandas/tslib.so in pandas.tslib._get_utcoffset (pandas/tslib.c:11327)()
AttributeError: 'str' object has no attribute 'utcoffset'
A temporary fix which i did was to add seconds to data manually while creating the index.