Skip to content
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

CLN/DOC: Refactor timeseries.rst intro and overview #22728

Merged
merged 4 commits into from
Sep 17, 2018

Conversation

mroeschke
Copy link
Member

Refactoring timeseries.rst introduction and overview to give a better introduction into pandas timeseries functionality:

  • Introduce a wider range of examples
  • Overview all scalar and array classes, related data types, and range methods, and NaT in the beginning

@mroeschke
Copy link
Member Author

screen shot 2018-09-15 at 10 56 12 pm

screen shot 2018-09-15 at 10 56 23 pm

screen shot 2018-09-15 at 10 56 32 pm

screen shot 2018-09-15 at 10 56 40 pm

Copy link
Member

@datapythonista datapythonista left a comment

Choose a reason for hiding this comment

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

Looks great, just added some ideas that I think would make the doc clearer.

saturday.day_name()
# Add 1 business day (Friday --> Monday)
monday = ts + pd.tseries.offsets.BDay()
monday.day_name()
Copy link
Member

Choose a reason for hiding this comment

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

may be we could rename ts to friday? I think it'd make the example more consistent and easier to understand.

converted = ts.asfreq('45Min', method='pad')
converted.head()
idx = pd.date_range('2018-01-01', periods=72, freq='H')
ts = pd.Series(np.random.randn(len(idx)), index=idx)
Copy link
Member

Choose a reason for hiding this comment

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

I'd prefer range over randn. The data won't also be deterministic, but when you do the mean, it'll be more clear, and the means will increase.

Also, may be it's difficult, but if you can find a resampling example where the original is much smaller than 72, I think it'd help users if we show the original data before showing the transformed data.

@@ -1443,7 +1486,7 @@ time. The method for this is :meth:`~Series.shift`, which is available on all of
the pandas objects.

.. ipython:: python

ts = pd.Series(np.random.randn(len(rng)), index=rng)
Copy link
Member

Choose a reason for hiding this comment

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

same as before regarding random vs range

pd.Series(pd.date_range('2000', freq='D', periods=3))

:class:`Series` and :class:`DataFrame` have extended data type support and functionality for ``datetime`` and ``timedelta``
data when the time data is used as data itself. The other time related concepts will be stored as ``object`` data.
Copy link
Member

Choose a reason for hiding this comment

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

I'd name "The other time related concepts", and may be show an example with a datetime Series, so it's easier to see what we exactly mean here.

@mroeschke
Copy link
Member Author

Good suggestions @datapythonista. Incorporated all your comments.

Copy link
Member

@datapythonista datapythonista left a comment

Choose a reason for hiding this comment

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

Great work, looks perfect.

@WillAyd WillAyd added the Docs label Sep 17, 2018
@mroeschke mroeschke merged commit 9e2039b into pandas-dev:master Sep 17, 2018
@mroeschke
Copy link
Member Author

Thanks @datapythonista @WillAyd.

@mroeschke mroeschke deleted the clean_timeseries_intro branch September 17, 2018 19:11
aeltanawy pushed a commit to aeltanawy/pandas that referenced this pull request Sep 20, 2018
* CLN/DOC: Refactor timeseries.rst intro and overview

* Address review

* Forgot missing is
Sup3rGeo pushed a commit to Sup3rGeo/pandas that referenced this pull request Oct 1, 2018
* CLN/DOC: Refactor timeseries.rst intro and overview

* Address review

* Forgot missing is
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.

3 participants