-
-
Couldn't load subscription status.
- Fork 19.2k
API/BUG: freq retention in value_counts #62532
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
Open
sanjanam1998 wants to merge 24 commits into pandas-dev:main Choose a base branch from sanjanam1998:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline, and old review comments may become outdated.
+70 −0
Open
Changes from all commits
Commits
Show all changes
24 commits Select commit Hold shift + click to select a range
05f3491 API/BUG: freq retention in value_counts
sanjanam1998 163c0f3 adding whats new
sanjanam1998 efbb2ce Merge branch 'main' into main
sanjanam1998 449313e Merge branch 'pandas-dev:main' into main
sanjanam1998 a946317 Merge branch 'pandas-dev:main' into main
sanjanam1998 74ad212 preserving freq without patching
sanjanam1998 9b3eeeb Merge branch 'main' into main
sanjanam1998 6a1c63d Merge branch 'main' into main
sanjanam1998 61a8b67 Merge branch 'pandas-dev:main' into main
sanjanam1998 b6d277c Merge branch 'main' into main
sanjanam1998 c8131c7 Merge branch 'pandas-dev:main' into main
sanjanam1998 d8acdff git fix
sanjanam1998 5331158 Merge branch 'main' into main
sanjanam1998 0890621 Merge branch 'main' into main
sanjanam1998 79a82d5 Merge branch 'pandas-dev:main' into main
sanjanam1998 b643a7c test changes
sanjanam1998 660da5b Merge branch 'main' into main
sanjanam1998 977d887 Merge branch 'main' into main
sanjanam1998 7198d97 Update pandas/core/algorithms.py
sanjanam1998 6d0133e Merge branch 'main' into main
sanjanam1998 5c36d37 Merge branch 'main' into main
sanjanam1998 409f8bb Merge branch 'pandas-dev:main' into main
sanjanam1998 85630e8 test optimize
sanjanam1998 ffad503 none typing
sanjanam1998 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 |
|---|---|---|
| | @@ -339,3 +339,59 @@ def test_value_counts_object_inference_deprecated(): | |
| exp = dti.value_counts() | ||
| exp.index = exp.index.astype(object) | ||
| tm.assert_series_equal(res, exp) | ||
| | ||
| | ||
| @pytest.mark.parametrize( | ||
| ("index", "expected_index"), | ||
| [ | ||
| pytest.param( | ||
| pd.date_range("2016-01-01", periods=5, freq="D"), | ||
| pd.date_range("2016-01-01", periods=5, freq="D"), | ||
| ), | ||
| pytest.param( | ||
| pd.timedelta_range(Timedelta(0), periods=5, freq="h"), | ||
| pd.timedelta_range(Timedelta(0), periods=5, freq="h"), | ||
| ), | ||
| pytest.param( | ||
| pd.date_range("2016-01-01", periods=5, freq="D").insert( | ||
| 1, pd.date_range("2016-01-01", periods=5, freq="D")[1] | ||
| ), | ||
| Comment on lines +356 to +358 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. Instead of using | ||
| DatetimeIndex(pd.date_range("2016-01-01", periods=5, freq="D")), | ||
| ), | ||
| pytest.param( | ||
| pd.timedelta_range(Timedelta(0), periods=5, freq="h").insert( | ||
| 1, pd.timedelta_range(Timedelta(0), periods=5, freq="h")[1] | ||
| ), | ||
| TimedeltaIndex(pd.timedelta_range(Timedelta(0), periods=5, freq="h")), | ||
| ), | ||
| pytest.param( | ||
| pd.date_range("2016-01-01", periods=5, freq="D").delete(2), | ||
| DatetimeIndex(pd.date_range("2016-01-01", periods=5, freq="D").delete(2)), | ||
| ), | ||
| pytest.param( | ||
| pd.timedelta_range(Timedelta(0), periods=5, freq="h").delete(2), | ||
| TimedeltaIndex( | ||
| pd.timedelta_range(Timedelta(0), periods=5, freq="h").delete(2) | ||
| ), | ||
| ), | ||
| pytest.param( | ||
| pd.date_range("2016-01-01", periods=5, freq="D").insert(1, pd.NaT), | ||
| DatetimeIndex( | ||
| list(pd.date_range("2016-01-01", periods=5, freq="D")[:1]) | ||
| + [pd.NaT] | ||
| + list(pd.date_range("2016-01-01", periods=5, freq="D")[1:]) | ||
| ), | ||
| ), | ||
| pytest.param( | ||
| pd.timedelta_range(Timedelta(0), periods=5, freq="h").insert(1, pd.NaT), | ||
| TimedeltaIndex( | ||
| list(pd.timedelta_range(Timedelta(0), periods=5, freq="h")[:1]) | ||
| + [pd.NaT] | ||
| + list(pd.timedelta_range(Timedelta(0), periods=5, freq="h")[1:]) | ||
| ), | ||
| ), | ||
| ], | ||
| ) | ||
| def test_value_counts_index_datetimelike(index, expected_index): | ||
| vc = index.value_counts(sort=False, dropna=False) | ||
| tm.assert_index_equal(vc.index, expected_index) | ||
sanjanam1998 marked this conversation as resolved. Show resolved Hide resolved | ||
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.