Skip to content

Commit 6e789c1

Browse files
authored
DOC: Changed M to MS in examples (#53927)
Changed M to MS in examples
1 parent 3b0fc88 commit 6e789c1

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

pandas/core/groupby/groupby.py

+9-9
Original file line numberDiff line numberDiff line change
@@ -764,8 +764,8 @@ def groups(self) -> dict[Hashable, np.ndarray]:
764764
2023-02-01 3
765765
2023-02-15 4
766766
dtype: int64
767-
>>> ser.resample('M').groups
768-
{Timestamp('2023-01-31 00:00:00'): 2, Timestamp('2023-02-28 00:00:00'): 4}
767+
>>> ser.resample('MS').groups
768+
{Timestamp('2023-01-01 00:00:00'): 2, Timestamp('2023-02-01 00:00:00'): 4}
769769
"""
770770
return self.grouper.groups
771771

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

@@ -1003,7 +1003,7 @@ def get_group(self, name, obj=None) -> DataFrame | Series:
10031003
2023-02-01 3
10041004
2023-02-15 4
10051005
dtype: int64
1006-
>>> ser.resample('M').get_group('2023-01-31')
1006+
>>> ser.resample('MS').get_group('2023-01-01')
10071007
2023-01-01 1
10081008
2023-01-15 2
10091009
dtype: int64
@@ -1085,13 +1085,13 @@ def __iter__(self) -> Iterator[tuple[Hashable, NDFrameT]]:
10851085
2023-02-01 3
10861086
2023-02-15 4
10871087
dtype: int64
1088-
>>> for x, y in ser.resample('M'):
1088+
>>> for x, y in ser.resample('MS'):
10891089
... print(f'{x}\\n{y}\\n')
1090-
2023-01-31 00:00:00
1090+
2023-01-01 00:00:00
10911091
2023-01-01 1
10921092
2023-01-15 2
10931093
dtype: int64
1094-
2023-02-28 00:00:00
1094+
2023-02-01 00:00:00
10951095
2023-02-01 3
10961096
2023-02-15 4
10971097
dtype: int64

pandas/core/resample.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -519,10 +519,10 @@ def ffill(self, limit: int | None = None):
519519
520520
Example for ``ffill`` with downsampling (we have fewer dates after resampling):
521521
522-
>>> ser.resample('M').ffill()
523-
2023-01-31 2
524-
2023-02-28 4
525-
Freq: M, dtype: int64
522+
>>> ser.resample('MS').ffill()
523+
2023-01-01 1
524+
2023-02-01 3
525+
Freq: MS, dtype: int64
526526
527527
Example for ``ffill`` with upsampling (fill the new dates with
528528
the previous value):

0 commit comments

Comments
 (0)