Skip to content

DOC: Add more documentation showcasing CalendarDay #22633

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

Closed

Conversation

mroeschke
Copy link
Member

xref #22288 (comment)

Highlighting usages of CalendarDay with date_range and resample specifically.

@mroeschke mroeschke added the Docs label Sep 8, 2018
@codecov
Copy link

codecov bot commented Sep 8, 2018

Codecov Report

Merging #22633 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master   #22633   +/-   ##
=======================================
  Coverage   92.16%   92.16%           
=======================================
  Files         169      169           
  Lines       50708    50708           
=======================================
  Hits        46734    46734           
  Misses       3974     3974
Flag Coverage Δ
#multiple 90.57% <ø> (ø) ⬆️
#single 42.35% <ø> (ø) ⬆️

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 996f361...3da2c7d. Read the comment docs.

idx = pd.date_range("2016-10-30", freq='H', periods=4*24, tz='Europe/Helsinki')
s = pd.Series(range(len(idx)), index=idx)
s.resample('D').count()
s.resample('CD').count()
Copy link
Member

Choose a reason for hiding this comment

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

Is this supposed to work on master? After a clean build locally I get a ValueError: Invalid frequency: CD.

Don't think doctest covers these files; if it does then my mistake but figured it was worth asking

Copy link
Member Author

Choose a reason for hiding this comment

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

This currently works on master:

In [3]: pd.__version__
Out[3]: '0.24.0.dev0+563.g0976e1261'

In [4]:    idx = pd.date_range("2016-10-30", freq='H', periods=4*24, tz='Europe/
   ...: Helsinki')
   ...:    s = pd.Series(range(len(idx)), index=idx)
   ...:    s.resample('D').count()
   ...:    s.resample('CD').count()
   ...:
   ...:
Out[4]:
2016-10-30 00:00:00+03:00    25
2016-10-31 00:00:00+02:00    24
2016-11-01 00:00:00+02:00    24
2016-11-02 00:00:00+02:00    23
Freq: CD, dtype: int64

I am not sure if the doctest uses master or the the latest tagged branch.

@@ -317,14 +317,34 @@ and respect calendar day arithmetic while :class:`Day` and frequency alias ``'D'
will now respect absolute time (:issue:`22274`, :issue:`20596`, :issue:`16980`, :issue:`8774`)
See the :ref:`documentation here <timeseries.dayvscalendarday>` for more information.

Addition with :class:`CalendarDay` across a daylight savings time transition:
The difference between :class:`Day` vs :class:`CalendarDay` is most apparent
with timezone-aware datetime data with a daylight savings time transition:
Copy link
Member

Choose a reason for hiding this comment

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

You say "most apparent with timezone-aware data". But is there a case where this is actually relevant for tz naive data?

Copy link
Member Author

Choose a reason for hiding this comment

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

There is no difference between Day and CalendarDay for tz naive data. I've parameterized some tz naive data tests for 'D' and 'CD' to ensure this behavior.

@pep8speaks
Copy link

Hello @mroeschke! Thanks for updating the PR.

@mroeschke mroeschke added this to the 0.24.0 milestone Sep 14, 2018
@mroeschke
Copy link
Member Author

Closing as we're not moving forward with "CD"

@mroeschke mroeschke closed this Sep 27, 2018
@mroeschke mroeschke deleted the document_calendarday_more branch September 27, 2018 20:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants