-
-
Notifications
You must be signed in to change notification settings - Fork 18.7k
BUG: _convert_and_box_cache raise ValueError: Tz-aware datetime.datetime cannot be converted to datetime64 unless utc=True #26097
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
655ec31
6a9856e
ffd9ecf
d6c584e
00f72e0
5ad9911
428cae0
7ed05f2
b60f1d5
3e2df79
3f0285e
d19c2cf
b1cf140
56db677
4f9ea36
c72a561
67a0c40
1e0d953
1942bbe
97e4548
342d7d0
12f9853
62e75f8
71ca9be
c35e124
d3412e2
3141cb6
ca200cd
1cc469e
137395f
2d8921b
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 |
---|---|---|
|
@@ -15,16 +15,16 @@ | |
ensure_object, is_datetime64_dtype, is_datetime64_ns_dtype, | ||
is_datetime64tz_dtype, is_float, is_integer, is_integer_dtype, | ||
is_list_like, is_numeric_dtype, is_scalar) | ||
from pandas.core.dtypes.generic import ABCDataFrame, ABCIndexClass, ABCSeries | ||
from pandas.core.dtypes.generic import ( | ||
ABCDataFrame, ABCDatetimeIndex, ABCIndex, ABCIndexClass, ABCSeries) | ||
from pandas.core.dtypes.missing import notna | ||
|
||
from pandas._typing import ( | ||
ArrayLike, IndexLike, IndexLikeOrNdarray, SeriesLike, Union) | ||
from pandas._typing import ArrayLike, Union | ||
from pandas.core import algorithms | ||
|
||
# annotations | ||
anmyachev marked this conversation as resolved.
Show resolved
Hide resolved
|
||
IntFltStrDateLisTuplArrSer = Union[int, float, str, list, tuple, | ||
datetime, ArrayLike, SeriesLike] | ||
DatetimeScalarOrArrayConvertible = Union[int, float, str, list, tuple, | ||
anmyachev marked this conversation as resolved.
Show resolved
Hide resolved
|
||
datetime, ArrayLike, ABCSeries] | ||
|
||
|
||
def _guess_datetime_format_for_array(arr, **kwargs): | ||
|
@@ -66,7 +66,8 @@ def _maybe_cache(arg, format, cache, convert_listlike): | |
return cache_array | ||
|
||
|
||
def _box_as_indexlike(dt_array: ArrayLike, tz=None, name=None) -> IndexLike: | ||
def _box_as_indexlike(dt_array: ArrayLike, | ||
tz=None, name=None) -> Union[ABCIndex, ABCDatetimeIndex]: | ||
anmyachev marked this conversation as resolved.
Show resolved
Hide resolved
|
||
""" | ||
Properly boxes the ndarray of datetimes to DatetimeIndex | ||
if it is possible or to generic Index instead | ||
|
@@ -92,9 +93,10 @@ def _box_as_indexlike(dt_array: ArrayLike, tz=None, name=None) -> IndexLike: | |
return Index(dt_array, name=name) | ||
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. We need to apply 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. @jreback @mroeschke After a close look at the Index constructor( 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. its default is |
||
|
||
|
||
def _convert_and_box_cache(arg: IntFltStrDateLisTuplArrSer, | ||
cache_array: SeriesLike, | ||
box: bool, name=None) -> IndexLikeOrNdarray: | ||
def _convert_and_box_cache(arg: DatetimeScalarOrArrayConvertible, | ||
anmyachev marked this conversation as resolved.
Show resolved
Hide resolved
|
||
cache_array: ABCSeries, | ||
box: bool, name=None) -> Union[ABCIndex, | ||
anmyachev marked this conversation as resolved.
Show resolved
Hide resolved
|
||
np.ndarray]: | ||
""" | ||
Convert array of dates with a cache and box the result | ||
|
||
|
@@ -111,8 +113,6 @@ def _convert_and_box_cache(arg: IntFltStrDateLisTuplArrSer, | |
Returns | ||
------- | ||
result : datetime of converted dates | ||
Returns: | ||
|
||
- Index-like if box=True | ||
- ndarray if box=False | ||
""" | ||
|
Uh oh!
There was an error while loading. Please reload this page.