Skip to content

CLN: Simplify Period Construction / Resolution #7607

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
Jul 6, 2014

Conversation

sinhrks
Copy link
Member

@sinhrks sinhrks commented Jun 29, 2014

Simplified Period construction a little by adding millisecond resolution.

MS_RESO = 1
S_RESO = 2
T_RESO = 3
H_RESO = 4
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I not sure this is tested but in theory an older pickle will break as these codes have changed
can u preserve the original codes (and just add the new one)?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I thought this is not stored as property. Modified.

@jreback jreback added this to the 0.14.1 milestone Jun 29, 2014
@@ -3357,13 +3357,16 @@ cpdef resolution(ndarray[int64_t] stamps, tz=None):
return reso

US_RESO = 0
MS_RESO = 0.5
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no make it 5
these are just enums

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it should have order for comparison. How should the value be?
https://github.com/pydata/pandas/blob/master/pandas/tseries/index.py#L1172

@jreback
Copy link
Contributor

jreback commented Jun 30, 2014

modify this to add Period/PeriodIndex https://github.com/pydata/pandas/blob/master/pandas/io/tests/generate_legacy_pickles.py

run it on 0.14.0 and add generated pickles to the repo
then test with this change to see if pickle works ok (if u can do more than 1 version/platform would be gr8)

@jreback
Copy link
Contributor

jreback commented Jun 30, 2014

if u want to add some for prior versions of pandas ok too (this scipy is meant to be independent of pandas versions for this reason)

the test suite will test the pickles on current version for back compat tests

@sinhrks
Copy link
Member Author

sinhrks commented Jun 30, 2014

Thanks. As Period can't be pickled, going to confirm PeriodIndex only.

import pickle
pickle.dumps(pd.Period('2011-01-01'))
# TypeError: a class that defines __slots__ without defining __getstate__ cannot be pickled

@jreback
Copy link
Contributor

jreback commented Jun 30, 2014

ahh right.....that is a separate issue (and should be resolved as well)

@sinhrks
Copy link
Member Author

sinhrks commented Jul 5, 2014

OK. Added PeriodIndex pickles taken in 0.13.0 and 0.14.0.

jreback added a commit that referenced this pull request Jul 6, 2014
CLN: Simplify Period Construction / Resolution
@jreback jreback merged commit 790d646 into pandas-dev:master Jul 6, 2014
@jreback
Copy link
Contributor

jreback commented Jul 6, 2014

gr8 thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Compat pandas objects compatability with Numpy or Python functions Period Period data type
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants