Skip to content

API: Return Index from DatetimeIndex/PeriodIndex.strftime #20240

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 2 commits into from
Mar 16, 2018

Conversation

reidy-p
Copy link
Contributor

@reidy-p reidy-p commented Mar 10, 2018

I will update the docstring after #20103 is merged.

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.

lgtm.

@@ -711,6 +711,7 @@ Other API Changes
- ``Categorical.fillna`` now validates its ``value`` and ``method`` keyword arguments. It now raises when both or none are specified, matching the behavior of :meth:`Series.fillna` (:issue:`19682`)
- ``pd.to_datetime('today')`` now returns a datetime, consistent with ``pd.Timestamp('today')``; previously ``pd.to_datetime('today')`` returned a ``.normalized()`` datetime (:issue:`19935`)
- :func:`Series.str.replace` now takes an optional `regex` keyword which, when set to ``False``, uses literal string replacement rather than regex replacement (:issue:`16808`)
- ``DatetimeIndex.strftime`` and ``PeriodIndex.strftime`` now return an ``Index`` instead of a numpy array to be consistent with similar accessors (:issue:`20127`)
Copy link
Contributor

Choose a reason for hiding this comment

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

can you add the :func: ref here

Copy link
Contributor

Choose a reason for hiding this comment

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

in theory you should have to change some tests on Series.dt.strftime, if you don't that means we are not fully testing this, can you check.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

But how would the output of Series.dt.strftime change when DatetimeIndex.strftime returns an Index instead of an array? It doesn't seem to ultimately affect anything in Series.dt.strftime from what I can tell.

@jreback jreback added Datetime Datetime data dtype Period Period data type Output-Formatting __repr__ of pandas objects, to_string API Design labels Mar 10, 2018
@jreback jreback added this to the 0.23.0 milestone Mar 13, 2018
@jreback
Copy link
Contributor

jreback commented Mar 13, 2018

@reidy-p merged the pre-cursor, can you rebase

@codecov
Copy link

codecov bot commented Mar 13, 2018

Codecov Report

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

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #20240      +/-   ##
==========================================
- Coverage   91.77%   91.76%   -0.02%     
==========================================
  Files         152      150       -2     
  Lines       49196    49151      -45     
==========================================
- Hits        45151    45102      -49     
- Misses       4045     4049       +4
Flag Coverage Δ
#multiple 90.14% <100%> (-0.02%) ⬇️
#single 41.9% <0%> (+0.08%) ⬆️
Impacted Files Coverage Δ
pandas/core/indexes/datetimelike.py 96.72% <100%> (ø) ⬆️
pandas/io/html.py 86.6% <0%> (-2.19%) ⬇️
pandas/io/formats/format.py 96.26% <0%> (-1.99%) ⬇️
pandas/core/algorithms.py 94.17% <0%> (-0.13%) ⬇️
pandas/compat/__init__.py 57.62% <0%> (-0.12%) ⬇️
pandas/core/arrays/categorical.py 95.06% <0%> (-0.06%) ⬇️
pandas/core/ops.py 96.35% <0%> (ø) ⬆️
pandas/core/strings.py 98.32% <0%> (ø) ⬆️
pandas/core/indexing.py 93.02% <0%> (ø) ⬆️
pandas/plotting/_core.py 82.27% <0%> (ø) ⬆️
... and 15 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 30e0006...af8b19d. Read the comment docs.

@jreback jreback merged commit 8ee6570 into pandas-dev:master Mar 16, 2018
@jreback
Copy link
Contributor

jreback commented Mar 16, 2018

thanks @reidy-p keep em coming!

@reidy-p reidy-p deleted the strftime_index branch March 17, 2018 23:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Design Datetime Datetime data dtype Output-Formatting __repr__ of pandas objects, to_string Period Period data type
Projects
None yet
Development

Successfully merging this pull request may close these issues.

API: DatetimeIndex.strftime should return an Index
2 participants