-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
BUG: to_datetime with xarray DataArray and specifie unit errors #44073
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
37 commits
Select commit
Hold shift + click to select a range
b534f56
Implemented the byte_string
shubham11941140 23583fc
Update test_convert_dtypes.py
shubham11941140 96338fa
Update test_convert_dtypes.py
shubham11941140 ad4189f
Update cast.py
shubham11941140 e915bc0
Passes the tests
shubham11941140 6d0a497
Removed PEP 8 issues
shubham11941140 5ab2d79
Update cast.py
shubham11941140 7921c6f
Removed Try Except Block
shubham11941140 3e7a91f
pre-commit changes added
shubham11941140 b5b0e27
mypy static error solved
shubham11941140 694fb7a
Updated as requested
shubham11941140 e12fd22
PEP-8 issues.
shubham11941140 b774cef
Update v1.3.3.rst - release note added
shubham11941140 f867f72
elif implemented
shubham11941140 0cb3f08
Changes done
shubham11941140 9760857
Merge branch 'master' into b2
shubham11941140 2e18ebc
Changes done
shubham11941140 3193de9
Update test_convert_dtypes.py
shubham11941140 20f8dda
Removed pre-commit error
shubham11941140 1503730
Update test_convert_dtypes.py
shubham11941140 c081d92
Added astype
shubham11941140 7654729
Compare bytes
shubham11941140 0a2e0a9
Remove build error
shubham11941140 d4e086c
Merge branch 'master' of https://github.com/pandas-dev/pandas into b2
shubham11941140 766a30f
Update 1.3.4.rst and removed 1.3.3.rst
shubham11941140 52ac57a
Merge branch 'master' into b2
shubham11941140 be03f37
Remove build error
shubham11941140 92677cc
Merge branch 'b2' of https://github.com/shubham11941140/pandas into b2
shubham11941140 07e1de9
Changed df
shubham11941140 5f2933d
Merge branch 'master' into b2
shubham11941140 bfb1242
Follows 1.2.5 behaviour
shubham11941140 37ee298
Merge branch 'b2' of https://github.com/shubham11941140/pandas into b2
shubham11941140 77ee435
Removed Whitespace
shubham11941140 e70f68b
Removed elif
shubham11941140 4560642
Merge branch 'master' of https://github.com/pandas-dev/pandas into b2
shubham11941140 35c0aee
xarray DataArray
shubham11941140 155563f
Added unit and removed PEP
shubham11941140 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2650,3 +2650,15 @@ def test_to_datetime_monotonic_increasing_index(cache): | |
result = to_datetime(times.iloc[:, 0], cache=cache) | ||
expected = times.iloc[:, 0] | ||
tm.assert_series_equal(result, expected) | ||
|
||
|
||
def test_xarray_DataArray(): | ||
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. you will need to skip if xarray is not installed |
||
#GH44073 | ||
import xarray as xr | ||
arr = xr.DataArray([1, 2, 3]) | ||
res = pd.to_datetime(arr, unit='ns') | ||
ex = DatetimeIndex(['1970-01-01 00:00:00.000000001', | ||
'1970-01-01 00:00:00.000000002', | ||
'1970-01-01 00:00:00.000000003'], | ||
dtype='datetime64[ns]', freq=None) | ||
tm.assert_index_equal(ex, res) |
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.
pls don't import xarray like this
it's not a dependency
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.
How do I do it? Should I write it on top?