Skip to content

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

Merged
merged 4 commits into from
Mar 7, 2020

Conversation

Hori75
Copy link
Contributor

@Hori75 Hori75 commented Feb 29, 2020

Output of python scripts/validate_docstrings.py pandas.DatetimeIndex

################################################################################
################################## Validation ##################################
################################################################################

1 Errors found:
	No examples section found

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
Copy link
Member

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.

@Hori75 Hori75 force-pushed the DatetimeIndex branch 2 times, most recently from 3ba0f76 to a2ae6f4 Compare February 29, 2020 13:30
Copy link
Member

@WillAyd WillAyd left a 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?

@WillAyd WillAyd added this to the 1.1 milestone Feb 29, 2020
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.
Copy link
Member

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
Copy link
Member

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.

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.
Copy link
Member

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
Copy link
Member

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?

Copy link
Member

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

Copy link
Contributor Author

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.

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
Copy link
Member

Choose a reason for hiding this comment

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

or str

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
Copy link
Member

Choose a reason for hiding this comment

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

default?

Note that the only NumPy dtype allowed is ‘datetime64[ns]’.
copy : bool
Make a copy of input ndarray.
name : object
Copy link
Member

Choose a reason for hiding this comment

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

Label

@datapythonista datapythonista merged commit 684a291 into pandas-dev:master Mar 7, 2020
@datapythonista
Copy link
Member

Thanks for the improvements to this docstring @Hori75

@Hori75 Hori75 deleted the DatetimeIndex branch March 9, 2020 09:22
SeeminSyed pushed a commit to CSCD01-team01/pandas that referenced this pull request Mar 22, 2020
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.

5 participants