-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
REF: Simplify Datetimelike constructor dispatching #23140
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 1 commit
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
f13cc58
Avoid non-public constructors
jbrockmendel 4188ec7
simplify and de-duplicate _generate_range
jbrockmendel 7804f1b
Check for invalid axis kwarg
jbrockmendel a4775f4
Move some EA properties up to mixins
jbrockmendel 8ee34fa
implement basic TimedeltaArray tests
jbrockmendel 78943c1
clean up PeriodArray constructor, with tests
jbrockmendel aa71383
make PeriodArray.__new__ more grown-up
jbrockmendel eae8389
Remove unused kwargs from TimedeltaArray.__new__
jbrockmendel e871733
revert change that broke tests
jbrockmendel 7840f91
Fixup whitespace
jbrockmendel ec50b0b
helper function for axis validation
jbrockmendel eb7a6b6
suggested clarifications
jbrockmendel 32c6391
Merge branch 'dlike8' of https://github.com/jbrockmendel/pandas into …
jbrockmendel c903917
Merge branch 'master' of https://github.com/pandas-dev/pandas into dl…
jbrockmendel b97ec96
move axis validation to nv
jbrockmendel 11db555
Merge branch 'master' of https://github.com/pandas-dev/pandas into dl…
jbrockmendel 147de57
revert some removals
jbrockmendel 7c4d281
Merge branch 'master' of https://github.com/pandas-dev/pandas into dl…
jbrockmendel b90f421
catch too-negative values
jbrockmendel dc4f474
Roll validate_minmax_axis into existing validate functions
jbrockmendel 46d5e64
fixup typo
jbrockmendel b5827c7
Merge branch 'master' of https://github.com/pandas-dev/pandas into dl…
jbrockmendel 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
simplify and de-duplicate _generate_range
- Loading branch information
commit 4188ec725aebc0140f6b8be34b66e5ab8e1a94f9
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
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 |
---|---|---|
|
@@ -241,9 +241,11 @@ def __new__(cls, data=None, | |
|
||
if data is None: | ||
# TODO: Remove this block and associated kwargs; GH#20535 | ||
return cls._generate_range(start, end, periods, name, freq, | ||
tz=tz, normalize=normalize, | ||
closed=closed, ambiguous=ambiguous) | ||
out = cls._generate_range(start, end, periods, | ||
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. out -> result 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. Will update. |
||
freq=freq, tz=tz, normalize=normalize, | ||
closed=closed, ambiguous=ambiguous) | ||
out.name = name | ||
return out | ||
|
||
if not isinstance(data, (np.ndarray, Index, ABCSeries, | ||
DatetimeArrayMixin)): | ||
|
@@ -315,17 +317,6 @@ def __new__(cls, data=None, | |
|
||
return subarr._deepcopy_if_needed(ref_to_data, copy) | ||
|
||
@classmethod | ||
@Appender(DatetimeArrayMixin._generate_range.__doc__) | ||
def _generate_range(cls, start, end, periods, name=None, freq=None, | ||
tz=None, normalize=False, ambiguous='raise', | ||
closed=None): | ||
out = super(DatetimeIndex, cls)._generate_range( | ||
start, end, periods, freq, | ||
tz=tz, normalize=normalize, ambiguous=ambiguous, closed=closed) | ||
out.name = name | ||
return out | ||
|
||
@classmethod | ||
def _use_cached_range(cls, freq, _normalized, start, end): | ||
# Note: This always returns False | ||
|
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
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.
why is this? can you comment
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.
Will clarify this comment.
kwargs
gets passed below tocls._generate_range
, and the only kwarg that is valid there is "ambiguous", and that is only for DatetimeArray.