-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
DOC: Fixing EX01 - Added examples #53818
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
Changes from 4 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
536b7c8
Examples api.types, Sparse, TZDtype
DeaMariaLeon 5924f9f
Merge remote-tracking branch 'upstream/main' into examples-Jun23
DeaMariaLeon 40eb274
Edited code_checks
DeaMariaLeon edb7a8e
Merge remote-tracking branch 'upstream/main' into examples-Jun23
DeaMariaLeon 5573573
Changed tz to zoneinfo
DeaMariaLeon 9a8c89e
Merge remote-tracking branch 'upstream/main' into examples-Jun23
DeaMariaLeon 11747d1
Added ZoneInfo for tz param
DeaMariaLeon cf9730d
Merge remote-tracking branch 'upstream/main' into examples-Jun23
DeaMariaLeon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -772,13 +772,25 @@ def _creso(self) -> int: | |
def unit(self) -> str_type: | ||
""" | ||
The precision of the datetime data. | ||
|
||
Examples | ||
-------- | ||
>>> dtype = pd.DatetimeTZDtype(tz='dateutil/US/Central') | ||
>>> dtype.unit | ||
'ns' | ||
""" | ||
return self._unit | ||
|
||
@property | ||
def tz(self) -> tzinfo: | ||
""" | ||
The timezone. | ||
|
||
Examples | ||
-------- | ||
>>> dtype = pd.DatetimeTZDtype(tz='dateutil/US/Central') | ||
>>> dtype.tz | ||
tzfile('/usr/share/zoneinfo/US/Central') | ||
""" | ||
return self._tz | ||
|
||
|
@@ -967,6 +979,12 @@ def __reduce__(self): | |
def freq(self): | ||
""" | ||
The frequency object of this PeriodDtype. | ||
|
||
Examples | ||
-------- | ||
>>> dtype = pd.PeriodDtype(freq='D') | ||
>>> dtype.freq | ||
<Day> | ||
""" | ||
return self._freq | ||
|
||
|
@@ -1217,6 +1235,12 @@ def closed(self) -> IntervalClosedType: | |
def subtype(self): | ||
""" | ||
The dtype of the Interval bounds. | ||
|
||
Examples | ||
-------- | ||
>>> dtype = pd.IntervalDtype(subtype='int64', closed='both') | ||
>>> dtype.subtype | ||
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. didn't know this existed, nice |
||
dtype('int64') | ||
""" | ||
return self._subtype | ||
|
||
|
@@ -1565,6 +1589,17 @@ class SparseDtype(ExtensionDtype): | |
Methods | ||
------- | ||
None | ||
|
||
Examples | ||
-------- | ||
>>> ser = pd.Series([1, 0, 0], dtype=pd.SparseDtype(dtype=int, fill_value=0)) | ||
>>> ser | ||
0 1 | ||
1 0 | ||
2 0 | ||
dtype: Sparse[int64, 0] | ||
>>> ser.sparse.density | ||
0.3333333333333333 | ||
""" | ||
|
||
# We include `_is_na_fill_value` in the metadata to avoid hash collisions | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Could you use
zoneinfo
for thetz
argument for these examples?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 used the example from the reference for
DatetimeTZDtype
because I wasn't familiar with it. It also usesdateutil
. Here is the link.Please tell me if I should change that.EDIT: Working on this (updated after review but incorrectly)