-
-
Notifications
You must be signed in to change notification settings - Fork 18.7k
DEPR: Deprecate cdate_range and merge into bdate_range #17691
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -88,7 +88,7 @@ Class Remarks How to create | |
.. _timeseries.representation: | ||
|
||
Timestamps vs. Time Spans | ||
-------------------------- | ||
------------------------- | ||
|
||
Timestamped data is the most basic type of time series data that associates | ||
values with points in time. For pandas objects it means using the points in | ||
|
@@ -263,12 +263,10 @@ pandas supports converting integer or float epoch times to ``Timestamp`` and | |
``DatetimeIndex``. The default unit is nanoseconds, since that is how ``Timestamp`` | ||
objects are stored internally. However, epochs are often stored in another ``unit`` | ||
which can be specified. These are computed from the starting point specified by the | ||
:ref:`Origin Parameter <timeseries.origin>`. | ||
``origin`` parameter. | ||
|
||
.. ipython:: python | ||
|
||
pd.Timestamp(1349720105, unit='s') | ||
|
||
pd.to_datetime([1349720105, 1349806505, 1349892905, | ||
1349979305, 1350065705], unit='s') | ||
|
||
|
@@ -292,6 +290,10 @@ which can be specified. These are computed from the starting point specified by | |
pd.to_datetime([1490195805.433, 1490195805.433502912], unit='s') | ||
pd.to_datetime(1490195805433502912, unit='ns') | ||
|
||
.. seealso:: | ||
|
||
:ref:`timeseries.origin` | ||
|
||
.. _timeseries.converting.epoch_inverse: | ||
|
||
From Timestamps to Epoch | ||
|
@@ -312,8 +314,8 @@ We convert the ``DatetimeIndex`` to an ``int64`` array, then divide by the conve | |
|
||
.. _timeseries.origin: | ||
|
||
Using the Origin Parameter | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
Using the ``origin`` Parameter | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
.. versionadded:: 0.20.0 | ||
|
||
|
@@ -353,7 +355,7 @@ To generate an index with timestamps, you can use either the ``DatetimeIndex`` o | |
|
||
In practice this becomes very cumbersome because we often need a very long | ||
index with a large number of timestamps. If we need timestamps on a regular | ||
frequency, we can use the ``date_range`` and ``bdate_range`` functions | ||
frequency, we can use the :func:`date_range` and :func:`bdate_range` functions | ||
to create a ``DatetimeIndex``. The default frequency for ``date_range`` is a | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can you make date_range and bdate_range references to their docstring? ( |
||
**calendar day** while the default for ``bdate_range`` is a **business day**: | ||
|
||
|
@@ -392,11 +394,16 @@ of those specified will not be generated: | |
|
||
pd.bdate_range(start=start, periods=20) | ||
|
||
.. _timeseries.custom-freq-ranges: | ||
|
||
Custom Frequency Ranges | ||
~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
.. versionadded:: 0.21.0 | ||
|
||
``bdate_range`` can also generate a range of custom frequency dates by using | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think if you indent this paragraph, it more 'belongs' to the versionadded directive (although not fully sure how it will look like when rendered) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I tried indenting and it rendered everything on the same line, i.e. "New in version 0.21.0: |
||
the ``weekmask`` and ``holidays`` parameters. These parameters will only be | ||
used if a custom frequency string is passed: | ||
used if a custom frequency string is passed. | ||
|
||
.. ipython:: python | ||
|
||
|
@@ -406,8 +413,19 @@ used if a custom frequency string is passed: | |
|
||
pd.bdate_range(start, end, freq='C', weekmask=weekmask, holidays=holidays) | ||
|
||
See the :ref:`Custom Business Days <timeseries.custombusinessdays>` section for | ||
additional information on custom frequencies. | ||
pd.bdate_range(start, end, freq='CBMS', weekmask=weekmask) | ||
|
||
.. warning:: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. move this to the top of the subsection. That way you can in the whatsnew refer directly to this section. |
||
|
||
This functionality was originally exclusive to ``cdate_range``, which is | ||
deprecated as of version 0.21.0 in favor of ``bdate_range``. Note that | ||
``cdate_range`` only utilizes the ``weekmask`` and ``holidays`` parameters | ||
when custom business day, 'C', is passed as the frequency string. Support has | ||
been expanded with ``bdate_range`` to work with any custom frequency string. | ||
|
||
.. seealso:: | ||
|
||
:ref:`timeseries.custombusinessdays` | ||
|
||
.. _timeseries.timestamp-limits: | ||
|
||
|
@@ -422,7 +440,9 @@ can be represented using a 64-bit integer is limited to approximately 584 years: | |
pd.Timestamp.min | ||
pd.Timestamp.max | ||
|
||
See :ref:`here <timeseries.oob>` for ways to represent data outside these bound. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think here the "for ways to represent data outside these bound" is actually useful to know that it is interesting to click this link There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, but the 'see also' block will show the full title, which is "representing out of bounds spans", which also says it. |
||
.. seealso:: | ||
|
||
:ref:`timeseries.oob` | ||
|
||
.. _timeseries.datetimeindex: | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -164,7 +164,6 @@ Other Enhancements | |
- :func:`read_excel` raises ``ImportError`` with a better message if ``xlrd`` is not installed. (:issue:`17613`) | ||
- :func:`read_json` now accepts a ``chunksize`` parameter that can be used when ``lines=True``. If ``chunksize`` is passed, read_json now returns an iterator which reads in ``chunksize`` lines with each iteration. (:issue:`17048`) | ||
- :meth:`DataFrame.assign` will preserve the original order of ``**kwargs`` for Python 3.6+ users instead of sorting the column names | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. move to deprecation section, mention the deprecation, and include a ref |
||
- :func:`bdate_range` has gained ``weekmask`` and ``holidays`` parameters for constructing custom frequency date ranges (:issue:`17596`) | ||
|
||
|
||
.. _whatsnew_0210.api_breaking: | ||
|
@@ -572,9 +571,9 @@ Deprecations | |
- :func:`SeriesGroupBy.nth` has deprecated ``True`` in favor of ``'all'`` for its kwarg ``dropna`` (:issue:`11038`). | ||
- :func:`DataFrame.as_blocks` is deprecated, as this is exposing the internal implementation (:issue:`17302`) | ||
- ``pd.TimeGrouper`` is deprecated in favor of :class:`pandas.Grouper` (:issue:`16747`) | ||
- ``cdate_range`` has been deprecated in favor of :func:`bdate_range` (:issue:`17596`) | ||
- ``cdate_range`` has been deprecated in favor of :func:`bdate_range`, which has gained ``weekmask`` and ``holidays`` parameters for building custom frequency date ranges. See the :ref:`documentation <timeseries.custom-freq-ranges>` for more details (:issue:`17596`) | ||
|
||
.. _whatsnew_0210.deprecations.argmin_min | ||
.. _whatsnew_0210.deprecations.argmin_min: | ||
|
||
Series.argmax and Series.argmin | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
@@ -740,9 +739,9 @@ Numeric | |
|
||
Categorical | ||
^^^^^^^^^^^ | ||
- Bug in :func:`Series.isin` when called with a categorical (:issue`16639`) | ||
- Bug in :func:`Series.isin` when called with a categorical (:issue:`16639`) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. thanks for fixing this! |
||
- Bug in the categorical constructor with empty values and categories causing the ``.categories`` to be an empty ``Float64Index`` rather than an empty ``Index`` with object dtype (:issue:`17248`) | ||
- Bug in categorical operations with :ref:`Series.cat <categorical.cat>' not preserving the original Series' name (:issue:`17509`) | ||
- Bug in categorical operations with :ref:`Series.cat <categorical.cat>` not preserving the original Series' name (:issue:`17509`) | ||
|
||
PyPy | ||
^^^^ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
underlines should match the length exactly