-
-
Notifications
You must be signed in to change notification settings - Fork 18.7k
REF/ENH: Constructors for DatetimeArray/TimedeltaArray #23493
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
Changes from 1 commit
f25d24c
e47c200
2cb7597
a4512b7
a5ef959
83b04fe
e8abc83
a4c8671
98dca45
56fd95e
5f92cfa
0e15536
1a015f6
5445a56
272f4b1
35195bd
bb394dc
510ae3d
49cf495
3a62633
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -217,7 +217,7 @@ def __new__(cls, values, freq=None, tz=None, dtype=None, copy=False): | |
if lib.is_scalar(values): | ||
jbrockmendel marked this conversation as resolved.
Show resolved
Hide resolved
|
||
raise ValueError('{cls}() must be called with a ' | ||
'collection of some kind, {data} was passed' | ||
.format(cls=cls.__name__, data=repr(data))) | ||
.format(cls=cls.__name__, data=repr(values))) | ||
elif isinstance(values, DatetimeArrayMixin): | ||
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.
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. And you don't need to get the 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.
No. For the moment we are still using inheritance, so this would mess up for DatetimeIndex == DatetimeArray. When we change to composition this check will have to become |
||
# extract nanosecond unix timestamps | ||
values = values.asi8 | ||
|
@@ -230,10 +230,7 @@ def __new__(cls, values, freq=None, tz=None, dtype=None, copy=False): | |
values = conversion.ensure_datetime64ns(values, copy=copy) | ||
|
||
result = cls._simple_new(values, freq=freq, tz=tz) | ||
if freq_infer: | ||
inferred = result.inferred_freq | ||
if inferred: | ||
result.freq = to_offset(inferred) | ||
dtl.maybe_define_freq(freq_infer, result) | ||
|
||
# NB: Among other things not yet ported from the DatetimeIndex | ||
# constructor, this does not call _deepcopy_if_needed | ||
|
Uh oh!
There was an error while loading. Please reload this page.