Skip to content

BUG: bug in to_msgpack for timezone aware datetime index #5507

New issue

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

Merged
merged 1 commit into from
Nov 13, 2013

Conversation

jreback
Copy link
Contributor

@jreback jreback commented Nov 13, 2013

BUG: bug in to_msgpack for no freqstr datetime index (GH5506)

closes #5506

BUG: bug in to_msgpack for no freqstr datetime index (GH5506)

TST: msgpack complex test comparisons fixed

API: allow df.to_msgpack() to return a string (no need to specify None for the path_or_buf)
@jreback
Copy link
Contributor Author

jreback commented Nov 13, 2013

The following is now supported (similar to json)

In [1]: pd.read_msgpack(DataFrame(np.random.randn(10,2)).to_msgpack())
Out[1]: 
          0         1
0 -1.755286 -0.528638
1  1.033457  1.211977
2  0.084770  2.017154
3 -0.326114  0.041828
4  2.002210 -0.620182
5  1.035762 -0.485474
6 -0.354471 -1.429922
7 -0.826269  1.331761
8 -1.893332  0.590906

@jreback
Copy link
Contributor Author

jreback commented Nov 13, 2013

This works too!

string concatetation of msgpacks reconstructs into a list of them (IOW each msgpacked object is a complete string in an of itself)

In [5]: pd.read_msgpack(DataFrame(np.random.randn(10,2)).to_msgpack() + DataFrame(np.random.randn(10,2),columns=list('AB')).to_msgpack())
Out[5]: 
[          0         1
0  0.907361 -1.070519
1  0.224163  0.231305
2 -0.307924  1.151119
3 -0.986642 -1.197128
4 -1.985134 -0.995994
5  0.706065 -0.640924
6 -0.035256  0.327645
7  0.358768  0.366619
8 -0.212340 -2.026615
9  0.472154 -1.007920,
           A         B
0 -0.139536 -2.702822
1 -0.101613  1.716294
2 -2.268146 -0.725065
3 -0.275433 -0.696792
4  1.085239 -1.267965
5  1.243207 -2.666420
6 -0.552880  1.164095
7 -0.318267  0.586724
8 -1.285713  1.753806
9 -0.680881 -0.861096]

jreback added a commit that referenced this pull request Nov 13, 2013
BUG: bug in to_msgpack for timezone aware datetime index
@jreback jreback merged commit 6a54af8 into pandas-dev:master Nov 13, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

to_msgpack() with DateTimeIndex: AttributeError: 'NoneType' object has no attribute 'freqstr'
1 participant