-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
DEPR: Deprecate use of un-supported numpy dt64/td64 dtype for pandas.array #53439
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 9 commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
158ebd3
Adding logic to deprecate the use of dt64/td64 dtypes for pandas.array
rmhowe425 4ff6dc5
Updating unit tests
rmhowe425 c15123d
Fixing unit tests
rmhowe425 4360254
Updating documentation to reflect the deprecation of dt64/d64 dtype.
rmhowe425 48a59ab
Updating whatsnew/v2.1.0.rst
rmhowe425 5efe978
Updating unit tests based on reviewer recommendations.
rmhowe425 e5a085d
Updating unit tests based on reviewer recommendations.
rmhowe425 7addd43
Adding back documentation that should'nt have been removed
rmhowe425 f5e5e49
Merge branch 'main' into dev/array/depr_dt64
rmhowe425 d3ba003
Fixing formatting error, adding documentation back that shouldn't hav…
rmhowe425 73de691
Updating unit tests per reviewer recommendation.
rmhowe425 19835a4
Fixing reviewer recomendations.
rmhowe425 2a98a57
Fixing pylint error
rmhowe425 2af83d4
Merge branch 'main' into dev/array/depr_dt64
rmhowe425 427e6d6
Fixing error in whatsnew documentation
rmhowe425 e8afca9
Merge branch 'main' into dev/array/depr_dt64
rmhowe425 a9d6573
Merge branch 'main' into dev/array/depr_dt64
rmhowe425 78f5fbd
Merge branch 'main' into dev/array/depr_dt64
rmhowe425 33c7f72
Fixing documentation error after fixing merge conflict
rmhowe425 5ca499f
Updating PR based on reviewer recommendations
rmhowe425 c3bdbf8
Updated PR based on reviewer recommendations
rmhowe425 26da8a6
Merge branch 'main' into dev/array/depr_dt64
rmhowe425 6b2b089
Merge branch 'main' into dev/array/depr_dt64
rmhowe425 0ab08ec
Merge branch 'main' into dev/array/depr_dt64
rmhowe425 5de5af3
Merge branch 'pandas-dev:main' into dev/array/depr_dt64
rmhowe425 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
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 |
---|---|---|
@@ -1,5 +1,6 @@ | ||
import datetime | ||
import decimal | ||
import re | ||
|
||
import numpy as np | ||
import pytest | ||
|
@@ -28,6 +29,20 @@ | |
) | ||
|
||
|
||
def test_dt64_array(): | ||
# PR 53439 | ||
dtype_unit_lst = ["M8[h]", "M8[m]", "m8[h]", "M8[m]"] | ||
|
||
for unit in dtype_unit_lst: | ||
dtype_var = np.dtype(unit) | ||
msg = ( | ||
"dtype={} is not supported. Supported resolutions are 's', 'ms', " | ||
"'us', and 'ns'".format(dtype_var) | ||
) | ||
with pytest.raises(TypeError, match=re.escape(msg)): | ||
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. this needs to issue a FutureWarning saying it will raise in the future (or cast to closest-supported-unit), not raise |
||
pd.array([], dtype=dtype_var) | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"data, dtype, expected", | ||
[ | ||
|
@@ -203,6 +218,8 @@ | |
], | ||
) | ||
def test_array(data, dtype, expected): | ||
with open("/home/richard/Desktop/file.txt", "a+") as fil: | ||
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. this shouldnt be needed |
||
fil.write(f"{dtype}\n") | ||
result = pd.array(data, dtype=dtype) | ||
tm.assert_equal(result, expected) | ||
|
||
|
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.
only un-supported. we supports "s", "ms", "us", "ns" resolutions