We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Trying df.to_msgpack() on a DataFrame with a DateTimeIndex produces an AttributeError.
Setting the index to an Int64Index fixes the issue, so it seems like it has to do with DateTimeIndex.
pd.version = '0.12.0-1095-g3239b29'
In [130]: from pandas.io.data import DataReader
In [131]: from pandas.io.packers import pack, unpack
In [132]: goog = DataReader('goog', 'yahoo')
In [133]: buf = pack(goog) AttributeError Traceback (most recent call last) in () ----> 1 buf = pack(goog)
/home/user/environments/python3/lib/python3.3/site-packages/pandas/io/packers.py in pack(o, default, encoding, unicode_errors, use_single_float) 507 return Packer(default=default, encoding=encoding, 508 unicode_errors=unicode_errors, --> 509 use_single_float=use_single_float).pack(o) 510 511
/home/user/environments/python3/lib/python3.3/site-packages/pandas/msgpack.cpython-33m.so in pandas.msgpack.Packer.pack (pandas/msgpack.cpp:3509)()
/home/user/environments/python3/lib/python3.3/site-packages/pandas/msgpack.cpython-33m.so in pandas.msgpack.Packer.pack (pandas/msgpack.cpp:3372)()
/home/user/environments/python3/lib/python3.3/site-packages/pandas/msgpack.cpython-33m.so in pandas.msgpack.Packer._pack (pandas/msgpack.cpp:3251)()
/home/user/environments/python3/lib/python3.3/site-packages/pandas/msgpack.cpython-33m.so in pandas.msgpack.Packer._pack (pandas/msgpack.cpp:2882)()
/home/user/environments/python3/lib/python3.3/site-packages/pandas/msgpack.cpython-33m.so in pandas.msgpack.Packer._pack (pandas/msgpack.cpp:3189)()
/home/user/environments/python3/lib/python3.3/site-packages/pandas/msgpack.cpython-33m.so in pandas.msgpack.Packer._pack (pandas/msgpack.cpp:3236)()
/home/user/environments/python3/lib/python3.3/site-packages/pandas/io/packers.py in encode(obj) 273 'dtype': obj.dtype.num, 274 'data': convert(obj.asi8), --> 275 'freq': obj.freqstr, 276 'tz': obj.tz} 277 elif isinstance(obj, MultiIndex):
/home/user/environments/python3/lib/python3.3/site-packages/pandas/tseries/index.py in freqstr(self) 1394 @Property 1395 def freqstr(self): -> 1396 return self.offset.freqstr 1397 1398 year = _field_accessor('year', 'Y')
AttributeError: 'NoneType' object has no attribute 'freqstr'
In [134]: goog Out[134]: <class 'pandas.core.frame.DataFrame'> DatetimeIndex: 973 entries, 2010-01-04 00:00:00 to 2013-11-12 00:00:00 Data columns (total 6 columns): Open 973 non-null values High 973 non-null values Low 973 non-null values Close 973 non-null values Volume 973 non-null values Adj Close 973 non-null values dtypes: float64(5), int64(1)
In [135]: goog.index = np.arange(973)
In [136]: buf = pack(goog)
In [137]: len(buf) Out[137]: 54908
The text was updated successfully, but these errors were encountered:
thanks for the report....fixed in PR #5507 (as well as an slightly related bug)
Sorry, something went wrong.
Cheers Jeff. Will give it a go after it's been merged.
@acowlikeobject already...give a try (this also changed df.to_msgpack() to return a string (I dropped the StringIO stuff externally...not necessary)
df.to_msgpack()
Successfully merging a pull request may close this issue.
Trying df.to_msgpack() on a DataFrame with a DateTimeIndex produces an AttributeError.
Setting the index to an Int64Index fixes the issue, so it seems like it has to do with DateTimeIndex.
pd.version = '0.12.0-1095-g3239b29'
In [130]: from pandas.io.data import DataReader
In [131]: from pandas.io.packers import pack, unpack
In [132]: goog = DataReader('goog', 'yahoo')
In [133]: buf = pack(goog)
AttributeError Traceback (most recent call last)
in ()
----> 1 buf = pack(goog)
/home/user/environments/python3/lib/python3.3/site-packages/pandas/io/packers.py in pack(o, default, encoding, unicode_errors, use_single_float)
507 return Packer(default=default, encoding=encoding,
508 unicode_errors=unicode_errors,
--> 509 use_single_float=use_single_float).pack(o)
510
511
/home/user/environments/python3/lib/python3.3/site-packages/pandas/msgpack.cpython-33m.so in pandas.msgpack.Packer.pack (pandas/msgpack.cpp:3509)()
/home/user/environments/python3/lib/python3.3/site-packages/pandas/msgpack.cpython-33m.so in pandas.msgpack.Packer.pack (pandas/msgpack.cpp:3372)()
/home/user/environments/python3/lib/python3.3/site-packages/pandas/msgpack.cpython-33m.so in pandas.msgpack.Packer._pack (pandas/msgpack.cpp:3251)()
/home/user/environments/python3/lib/python3.3/site-packages/pandas/msgpack.cpython-33m.so in pandas.msgpack.Packer._pack (pandas/msgpack.cpp:2882)()
/home/user/environments/python3/lib/python3.3/site-packages/pandas/msgpack.cpython-33m.so in pandas.msgpack.Packer._pack (pandas/msgpack.cpp:3189)()
/home/user/environments/python3/lib/python3.3/site-packages/pandas/msgpack.cpython-33m.so in pandas.msgpack.Packer._pack (pandas/msgpack.cpp:3236)()
/home/user/environments/python3/lib/python3.3/site-packages/pandas/io/packers.py in encode(obj)
273 'dtype': obj.dtype.num,
274 'data': convert(obj.asi8),
--> 275 'freq': obj.freqstr,
276 'tz': obj.tz}
277 elif isinstance(obj, MultiIndex):
/home/user/environments/python3/lib/python3.3/site-packages/pandas/tseries/index.py in freqstr(self)
1394 @Property
1395 def freqstr(self):
-> 1396 return self.offset.freqstr
1397
1398 year = _field_accessor('year', 'Y')
AttributeError: 'NoneType' object has no attribute 'freqstr'
In [134]: goog
Out[134]:
<class 'pandas.core.frame.DataFrame'>
DatetimeIndex: 973 entries, 2010-01-04 00:00:00 to 2013-11-12 00:00:00
Data columns (total 6 columns):
Open 973 non-null values
High 973 non-null values
Low 973 non-null values
Close 973 non-null values
Volume 973 non-null values
Adj Close 973 non-null values
dtypes: float64(5), int64(1)
In [135]: goog.index = np.arange(973)
In [136]: buf = pack(goog)
In [137]: len(buf)
Out[137]: 54908
The text was updated successfully, but these errors were encountered: