Skip to content

DOC: Changed M to MS in examples #53927

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

Merged
merged 1 commit into from
Jun 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
18 changes: 9 additions & 9 deletions pandas/core/groupby/groupby.py
Original file line number Diff line number Diff line change
Expand Up @@ -764,8 +764,8 @@ def groups(self) -> dict[Hashable, np.ndarray]:
2023-02-01 3
2023-02-15 4
dtype: int64
>>> ser.resample('M').groups
{Timestamp('2023-01-31 00:00:00'): 2, Timestamp('2023-02-28 00:00:00'): 4}
>>> ser.resample('MS').groups
{Timestamp('2023-01-01 00:00:00'): 2, Timestamp('2023-02-01 00:00:00'): 4}
"""
return self.grouper.groups

Expand Down Expand Up @@ -818,9 +818,9 @@ def indices(self) -> dict[Hashable, npt.NDArray[np.intp]]:
2023-02-01 3
2023-02-15 4
dtype: int64
>>> ser.resample('M').indices
defaultdict(<class 'list'>, {Timestamp('2023-01-31 00:00:00'): [0, 1],
Timestamp('2023-02-28 00:00:00'): [2, 3]})
>>> ser.resample('MS').indices
defaultdict(<class 'list'>, {Timestamp('2023-01-01 00:00:00'): [0, 1],
Timestamp('2023-02-01 00:00:00'): [2, 3]})
"""
return self.grouper.indices

Expand Down Expand Up @@ -1003,7 +1003,7 @@ def get_group(self, name, obj=None) -> DataFrame | Series:
2023-02-01 3
2023-02-15 4
dtype: int64
>>> ser.resample('M').get_group('2023-01-31')
>>> ser.resample('MS').get_group('2023-01-01')
2023-01-01 1
2023-01-15 2
dtype: int64
Expand Down Expand Up @@ -1085,13 +1085,13 @@ def __iter__(self) -> Iterator[tuple[Hashable, NDFrameT]]:
2023-02-01 3
2023-02-15 4
dtype: int64
>>> for x, y in ser.resample('M'):
>>> for x, y in ser.resample('MS'):
... print(f'{x}\\n{y}\\n')
2023-01-31 00:00:00
2023-01-01 00:00:00
2023-01-01 1
2023-01-15 2
dtype: int64
2023-02-28 00:00:00
2023-02-01 00:00:00
2023-02-01 3
2023-02-15 4
dtype: int64
Expand Down
8 changes: 4 additions & 4 deletions pandas/core/resample.py
Original file line number Diff line number Diff line change
Expand Up @@ -519,10 +519,10 @@ def ffill(self, limit: int | None = None):

Example for ``ffill`` with downsampling (we have fewer dates after resampling):

>>> ser.resample('M').ffill()
2023-01-31 2
2023-02-28 4
Freq: M, dtype: int64
>>> ser.resample('MS').ffill()
2023-01-01 1
2023-02-01 3
Freq: MS, dtype: int64

Example for ``ffill`` with upsampling (fill the new dates with
the previous value):
Expand Down