Skip to content

ENH: add ignore index to DataFrame / Series.sample #38594

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
wants to merge 32 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
cd232bb
add test
erfannariman Dec 20, 2020
57a9c5b
add type hints
erfannariman Dec 20, 2020
954944e
add ignore index to dataframe.sample
erfannariman Dec 20, 2020
9883480
fix line length
erfannariman Dec 20, 2020
38fa830
added whatsnew entry
erfannariman Dec 20, 2020
69c3e99
typo in whatsnew entry
erfannariman Dec 20, 2020
b71e149
remove unused variable
erfannariman Dec 20, 2020
00ab22b
moved whatsnew to 1.3.0
erfannariman Dec 20, 2020
c49626f
versionadded bumped to 1.3.0
erfannariman Dec 20, 2020
03fef32
fix isort error
erfannariman Dec 21, 2020
529f6be
fix typing
erfannariman Dec 21, 2020
335c8e6
fix type hints
erfannariman Dec 21, 2020
094782a
replace arraylike
erfannariman Dec 21, 2020
14d670c
fix isort
erfannariman Dec 21, 2020
8b674eb
move RandomState to typing
erfannariman Dec 22, 2020
a5159e5
remove optional
erfannariman Dec 22, 2020
7ef10ae
fix generator and Optional
erfannariman Dec 22, 2020
762abe3
Merge branch 'master' into 38581-add-ignore-index-sample
erfannariman Dec 22, 2020
e407b83
Merge remote-tracking branch 'upstream/master' into 38581-add-ignore-…
erfannariman Dec 22, 2020
b8963b8
check for np version
erfannariman Dec 23, 2020
cdd0a55
Merge branch 'master' into 38581-add-ignore-index-sample
erfannariman Dec 23, 2020
7f4606c
fix isort
erfannariman Dec 23, 2020
8507c9f
fix if else
erfannariman Dec 25, 2020
7159121
fix merge conflict
erfannariman Dec 25, 2020
3427e15
fix isort
erfannariman Dec 25, 2020
b71e60d
merge master
erfannariman Dec 31, 2020
ad64f3f
add type annotation
erfannariman Dec 31, 2020
4c78626
changes black
erfannariman Dec 31, 2020
8c70c98
remove typing RandomState
erfannariman Dec 31, 2020
cf394e0
remove import
erfannariman Dec 31, 2020
aed0f04
remove any random state
erfannariman Dec 31, 2020
ac9f600
Merge branch 'master' into 38581-add-ignore-index-sample
erfannariman Dec 31, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions pandas/_typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,3 +158,6 @@
ColspaceArgType = Union[
str, int, Sequence[Union[str, int]], Mapping[Label, Union[str, int]]
]

# random generator
RandomState = Optional[Union[int, ArrayLike, np.random.BitGenerator, np.random.RandomState]]
5 changes: 2 additions & 3 deletions pandas/core/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
JSONSerializable,
Label,
Level,
RandomState,
Renamer,
StorageOptions,
TimedeltaConvertibleTypes,
Expand Down Expand Up @@ -5139,9 +5140,7 @@ def sample(
frac: Optional[float] = None,
replace: bool_t = False,
weights: Optional[Union[str, ArrayLike]] = None,
random_state: Optional[
Union[int, ArrayLike, np.random.BitGenerator, np.random.RandomState]
] = None,
random_state: RandomState = None,
axis: Optional[Axis] = None,
ignore_index: Optional[bool_t] = False,
) -> FrameOrSeries:
Expand Down