Skip to content

ENH: Implement linspace behavior for timedelta_range and interval_range #21009

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 1 commit into from
May 11, 2018

Conversation

jschendel
Copy link
Member

Summary:

  • added linspace behavior support to timedelta_range
  • added linspace behavior support to interval_range
    • refactored test_interval_range.py to use parametrize; split up some tests
  • added a check to bdate_range to ensure that freq is specified
    • doesn't really make sense to support linspace behavior since bdate_range implies a frequency
    • same underlying code as date_range; could get linspace behavior by overriding freq to None
  • updated and cleaned docstrings for all *_range functions except period_range

if data is None and freq is None \
and com._any_none(periods, start, end):
raise ValueError("Must provide freq argument if no data is "
"supplied")
Copy link
Member Author

Choose a reason for hiding this comment

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

small refactor here; moved this code a few lines down so all the if data is None: code is in one place.

@codecov
Copy link

codecov bot commented May 11, 2018

Codecov Report

Merging #21009 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #21009      +/-   ##
==========================================
+ Coverage   91.82%   91.82%   +<.01%     
==========================================
  Files         153      153              
  Lines       49491    49505      +14     
==========================================
+ Hits        45446    45460      +14     
  Misses       4045     4045
Flag Coverage Δ
#multiple 90.22% <100%> (ø) ⬆️
#single 41.88% <77.77%> (+0.02%) ⬆️
Impacted Files Coverage Δ
pandas/core/indexes/interval.py 93.14% <100%> (+0.05%) ⬆️
pandas/core/indexes/datetimes.py 95.77% <100%> (+0.01%) ⬆️
pandas/core/indexes/timedeltas.py 91.24% <100%> (+0.08%) ⬆️

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 52effcb...a220176. Read the comment docs.

@jreback jreback added Enhancement Timedelta Timedelta data type Interval Interval data type labels May 11, 2018
@jreback jreback added this to the 0.23.0 milestone May 11, 2018
@jreback jreback merged commit 648ca95 into pandas-dev:master May 11, 2018
@jreback
Copy link
Contributor

jreback commented May 11, 2018

nice patch @jschendel !

Ideally we could add a small doc-update in timeseries: http://pandas-docs.github.io/pandas-docs-travis/timeseries.html#generating-ranges-of-timestamps

and in the timedelta / interval sections if appropriate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Interval Interval data type Timedelta Timedelta data type
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ENH: linspace behavior for timedelta_range and interval_range
2 participants