-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
DOC: Fix quotes position in Timestamp and Timedelta #24243
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
Closed
Closed
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
84e7d9d
docs: formatted docs strings
2966633
fix: reverted invalid docstring format
b44ecf1
docs: updated docstrings format
562e213
docs: formatted docstrings
78d12b0
docs: fixed docstrings
5bcad05
docs: fixed docstrings
35ac7ad
docs: fixed docstring
57d8460
docs: added line to_timedealta64
83b5fa4
docs: fixed docstrings
9a48b4a
docs: fixed files according to pep8
67a0632
docs: fixed conflict in docstring
d618b9e
docs: fixed identation
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -253,8 +253,10 @@ def array_to_timedelta64(object[:] values, unit='ns', errors='raise'): | |
|
||
|
||
cdef inline int64_t cast_from_unit(object ts, object unit) except? -1: | ||
""" return a casting of the unit represented to nanoseconds | ||
round the fractional part of a float to our precision, p """ | ||
""" | ||
return a casting of the unit represented to nanoseconds | ||
round the fractional part of a float to our precision, p | ||
""" | ||
cdef: | ||
int64_t m | ||
int p | ||
|
@@ -482,7 +484,6 @@ cdef inline parse_timedelta_string(object ts): | |
|
||
cdef inline int64_t timedelta_as_neg(int64_t value, bint neg): | ||
""" | ||
|
||
Parameters | ||
---------- | ||
value : int64_t of the timedelta value | ||
|
@@ -495,7 +496,6 @@ cdef inline int64_t timedelta_as_neg(int64_t value, bint neg): | |
|
||
cdef inline timedelta_from_spec(object number, object frac, object unit): | ||
""" | ||
|
||
Parameters | ||
---------- | ||
number : a list of number digits | ||
|
@@ -739,9 +739,18 @@ cdef _to_py_int_float(v): | |
# heavy lifting. | ||
cdef class _Timedelta(timedelta): | ||
cdef readonly: | ||
int64_t value # nanoseconds | ||
object freq # frequency reference | ||
bint is_populated # are my components populated | ||
int64_t value | ||
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. huh? this is so much harder to read, just revert this |
||
""" | ||
nanoseconds | ||
""" | ||
object freq | ||
""" | ||
frequency reference | ||
""" | ||
bint is_populated | ||
""" | ||
are my components populated | ||
""" | ||
int64_t _d, _h, _m, _s, _ms, _us, _ns | ||
|
||
# higher than np.ndarray and np.matrix | ||
|
@@ -813,7 +822,9 @@ cdef class _Timedelta(timedelta): | |
return timedelta(microseconds=int(self.value) / 1000) | ||
|
||
def to_timedelta64(self): | ||
""" Returns a numpy.timedelta64 object with 'ns' precision """ | ||
""" | ||
Returns a numpy.timedelta64 object with 'ns' precision | ||
""" | ||
return np.timedelta64(self.value, 'ns') | ||
|
||
def total_seconds(self): | ||
|
@@ -823,12 +834,16 @@ cdef class _Timedelta(timedelta): | |
return self.value / 1e9 | ||
|
||
def view(self, dtype): | ||
""" array view compat """ | ||
""" | ||
array view compat | ||
""" | ||
return np.timedelta64(self.value).view(dtype) | ||
|
||
@property | ||
def components(self): | ||
""" Return a Components NamedTuple-like """ | ||
""" | ||
Return a Components NamedTuple-like | ||
""" | ||
self._ensure_components() | ||
# return the named tuple | ||
return Components(self._d, self._h, self._m, self._s, | ||
|
@@ -897,6 +912,7 @@ cdef class _Timedelta(timedelta): | |
>>> td.asm8 | ||
numpy.timedelta64(42,'ns') | ||
""" | ||
|
||
return np.int64(self.value).view('m8[ns]') | ||
|
||
@property | ||
|
@@ -993,15 +1009,13 @@ cdef class _Timedelta(timedelta): | |
|
||
def _repr_base(self, format=None): | ||
""" | ||
|
||
Parameters | ||
---------- | ||
format : None|all|sub_day|long | ||
|
||
Returns | ||
------- | ||
converted : string of a Timedelta | ||
|
||
""" | ||
cdef object sign, seconds_pretty, subs, fmt, comp_dict | ||
|
||
|
@@ -1127,7 +1141,6 @@ class Timedelta(_Timedelta): | |
Notes | ||
----- | ||
The ``.value`` attribute is always in ns. | ||
|
||
""" | ||
def __new__(cls, object value=_no_input, unit=None, **kwargs): | ||
cdef _Timedelta td_base | ||
|
@@ -1473,7 +1486,8 @@ cdef _rfloordiv(int64_t value, right): | |
cdef _broadcast_floordiv_td64(int64_t value, object other, | ||
object (*operation)(int64_t value, | ||
object right)): | ||
"""Boilerplate code shared by Timedelta.__floordiv__ and | ||
""" | ||
Boilerplate code shared by Timedelta.__floordiv__ and | ||
Timedelta.__rfloordiv__ because np.timedelta64 does not implement these. | ||
|
||
Parameters | ||
|
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
Oops, something went wrong.
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.
this is not aligned here