Skip to content

CLN: Move period.pyx to tslibs/period.pyx #18555

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

Conversation

AaronCritchley
Copy link
Contributor

Is a whatsnew entry needed here?

from tslibs.np_datetime cimport (pandas_datetimestruct,
dtstruct_to_dt64, dt64_to_dtstruct,
is_leapyear)
from pandas._libs.tslibs.np_datetime cimport (pandas_datetimestruct,
Copy link
Contributor

Choose a reason for hiding this comment

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

the beauty here is that you can do

from np_datetime cimport .... and so on , the puts period in the same dir as all of the tslibs

('pandas.core.indexes.period', 'PeriodIndex')
('pandas.core.indexes.period', 'PeriodIndex'),

# 18543 moving period
Copy link
Contributor

Choose a reason for hiding this comment

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

is there a reason you are changing this? this is a private import and should not be needed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I saw ('pandas._period', 'Period'): ('pandas._libs.period', 'Period'), on Line 77, and was under the impression I needed to add something for this too.

Although I now realise that even if I did need this code, it would be wrong cause I'd need to modify the value on L77 too.

Would you like me to just remove this new line? and should I modify L77 too?

Copy link
Contributor

Choose a reason for hiding this comment

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

hmm ok
why don’t u put the line right under the other one then

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point, they seemed to be 'batched' by issue, but it'd be more readable if it was under the original, will move!

@jreback jreback added Clean Period Period data type labels Nov 28, 2017
@jbrockmendel
Copy link
Member

+1 on this, @AaronCritchley thanks for taking the initiative on this. @jreback thoughts on putting period_helper either in tslibs or tslibs/src?

@jreback
Copy link
Contributor

jreback commented Nov 29, 2017

@jreback thoughts on putting period_helper either in tslibs or tslibs/src?

move datetime / period to a tslibs/src would be ok i think (but separate / orthogonal PR).

@codecov
Copy link

codecov bot commented Dec 3, 2017

Codecov Report

Merging #18555 into master will decrease coverage by 0.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #18555      +/-   ##
==========================================
- Coverage   91.46%   91.45%   -0.02%     
==========================================
  Files         157      157              
  Lines       51447    51449       +2     
==========================================
- Hits        47055    47051       -4     
- Misses       4392     4398       +6
Flag Coverage Δ
#multiple 89.32% <100%> (ø) ⬆️
#single 40.6% <100%> (-0.09%) ⬇️
Impacted Files Coverage Δ
pandas/compat/pickle_compat.py 75.6% <ø> (ø) ⬆️
pandas/core/indexes/period.py 92.94% <100%> (ø) ⬆️
pandas/core/indexes/accessors.py 89.36% <100%> (ø) ⬆️
pandas/core/resample.py 96.34% <100%> (ø) ⬆️
pandas/core/indexes/datetimelike.py 97.11% <100%> (ø) ⬆️
pandas/core/indexes/datetimes.py 95.69% <100%> (ø) ⬆️
pandas/io/gbq.py 25% <0%> (-58.34%) ⬇️
pandas/core/frame.py 97.81% <0%> (-0.1%) ⬇️
pandas/io/parsers.py 95.55% <0%> (-0.05%) ⬇️
pandas/core/indexes/base.py 96.45% <0%> (-0.02%) ⬇️
... and 4 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d163de7...dd5021f. Read the comment docs.

@jreback jreback added this to the 0.22.0 milestone Dec 3, 2017
Copy link
Contributor

@jreback jreback left a comment

Choose a reason for hiding this comment

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

minor changes. ping on green.


cimport util
from util cimport is_period_object, is_string_object, INT32_MIN

from missing cimport is_null_datetimelike
from pandas._libs.missing cimport is_null_datetimelike
from pandas._libs.tslib import Timestamp
Copy link
Contributor

Choose a reason for hiding this comment

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

change this to

```from timestamps import Timestamp``

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good spot, I shouldn't have missed this, thanks!

@@ -74,7 +74,11 @@ def load_reduce(self):
('pandas._libs.sparse', 'BlockIndex'),
('pandas.tslib', 'Timestamp'):
('pandas._libs.tslib', 'Timestamp'),
('pandas._period', 'Period'): ('pandas._libs.period', 'Period'),
('pandas._period', 'Period'): ('pandas._libs.tslibs.period', 'Period'),

Copy link
Contributor

Choose a reason for hiding this comment

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

put the comment above the period ones (so they are all grouped together)

@jreback
Copy link
Contributor

jreback commented Dec 3, 2017

lgtm. ping on green.

@AaronCritchley
Copy link
Contributor Author

@jreback Green! 😄

@jreback jreback merged commit dc5403f into pandas-dev:master Dec 3, 2017
@jreback
Copy link
Contributor

jreback commented Dec 3, 2017

thanks @AaronCritchley keep em coming!

@AaronCritchley AaronCritchley deleted the improvement/moving-period-to-tslibs branch December 3, 2017 22:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Clean Period Period data type
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants