-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
DOC: Update the pandas.DatetimeIndex docstring #32360
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
Conversation
pandas/core/indexes/datetimes.py
Outdated
normalize : bool, default False | ||
Normalize start/end dates to midnight before generating date range. | ||
closed : {None, 'left', 'right'}, optional | ||
Make the interval closed with respect to the given frequency to |
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.
I think that you can remove the None
here, since we are saying that this parameter is optional.
3ba0f76
to
a2ae6f4
Compare
a2ae6f4
to
ebc0193
Compare
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.
lgtm @jbrockmendel care to take a look?
pandas/core/indexes/datetimes.py
Outdated
Immutable ndarray of datetime64 data, represented internally as int64, and | ||
which can be boxed to Timestamp objects that are subclasses of datetime and | ||
carry metadata such as frequency information. | ||
Immutable ndarray of datetime64 data. |
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.
not actually an ndarray anymore. maybe "ndarray-like"?
carry metadata such as frequency information. | ||
Immutable ndarray of datetime64 data. | ||
|
||
Represented internally as int64, and which can be boxed to Timestamp objects |
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.
its a stretch to say "represented internally as int64" is accurate.
mentioning that DTI has freq is good, but id rather avoid mentioning it for Timestamp.
pandas/core/indexes/datetimes.py
Outdated
freq : str or pandas offset object, optional | ||
One of pandas date offset strings or corresponding objects. The string | ||
'infer' can be passed in order to set the frequency of the index as the | ||
inferred frequency upon creation. | ||
tz : pytz.timezone or dateutil.tz.tzfile | ||
Timezone of the datetime. |
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.
we also support stdlib tzinfos, and you can pass strings that can be parsed to timezones
Timezone of the datetime. | ||
normalize : bool, default False | ||
Normalize start/end dates to midnight before generating date range. | ||
closed : {'left', 'right'}, optional |
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.
should "both:" be in here?
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.
can we avoid the word "interval" below? dont want ambiguity with IntervalIndex
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.
I think None
means both.
pandas/core/indexes/datetimes.py
Outdated
dayfirst : bool, default False | ||
If True, parse dates in `data` with the day first order. | ||
yearfirst : bool, default False | ||
If True parse dates in `data` with the year first order. | ||
dtype : numpy.dtype or DatetimeTZDtype |
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.
or str
pandas/core/indexes/datetimes.py
Outdated
dayfirst : bool, default False | ||
If True, parse dates in `data` with the day first order. | ||
yearfirst : bool, default False | ||
If True parse dates in `data` with the year first order. | ||
dtype : numpy.dtype or DatetimeTZDtype | ||
Note that the only NumPy dtype allowed is ‘datetime64[ns]’. | ||
copy : bool |
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.
default?
pandas/core/indexes/datetimes.py
Outdated
Note that the only NumPy dtype allowed is ‘datetime64[ns]’. | ||
copy : bool | ||
Make a copy of input ndarray. | ||
name : object |
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.
Label
Thanks for the improvements to this docstring @Hori75 |
black pandas
git diff upstream/master -u -- "*.py" | flake8 --diff
Output of
python scripts/validate_docstrings.py pandas.DatetimeIndex