Skip to content

Commit 4c401e7

Browse files
committed
run pre-commit
1 parent f8937fd commit 4c401e7

File tree

1 file changed

+31
-17
lines changed

1 file changed

+31
-17
lines changed

pandas/core/series.py

Lines changed: 31 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2997,7 +2997,6 @@ def compare(
29972997
keep_equal: bool = False,
29982998
result_names: Suffixes = ("self", "other"),
29992999
) -> DataFrame | Series:
3000-
30013000
"""
30023001
Compare to another Series and show the differences.
30033002
@@ -3026,7 +3025,7 @@ def compare(
30263025
Set the dataframes names in the comparison.
30273026
30283027
.. versionadded:: 1.5.0
3029-
3028+
30303029
Returns
30313030
-------
30323031
Series or DataFrame
@@ -4614,10 +4613,10 @@ def aggregate(self, func=None, axis: Axis = 0, *args, **kwargs):
46144613
3 4
46154614
dtype: int64
46164615
4617-
>>> s.agg('min')
4616+
>>> s.agg("min")
46184617
1
46194618
4620-
>>> s.agg(['min', 'max'])
4619+
>>> s.agg(["min", "max"])
46214620
min 1
46224621
max 4
46234622
dtype: int64
@@ -4686,7 +4685,7 @@ def transform(
46864685
46874686
Examples
46884687
--------
4689-
>>> df = pd.DataFrame({{'A': range(3), 'B': range(1, 4)}})
4688+
>>> df = pd.DataFrame({{"A": range(3), "B": range(1, 4)}})
46904689
>>> df
46914690
A B
46924691
0 0 1
@@ -4715,12 +4714,23 @@ def transform(
47154714
47164715
You can call transform on a GroupBy object:
47174716
4718-
>>> df = pd.DataFrame({{
4719-
... "Date": [
4720-
... "2015-05-08", "2015-05-07", "2015-05-06", "2015-05-05",
4721-
... "2015-05-08", "2015-05-07", "2015-05-06", "2015-05-05"],
4722-
... "Data": [5, 8, 6, 1, 50, 100, 60, 120],
4723-
... }})
4717+
>>> df = pd.DataFrame(
4718+
... {
4719+
... {
4720+
... "Date": [
4721+
... "2015-05-08",
4722+
... "2015-05-07",
4723+
... "2015-05-06",
4724+
... "2015-05-05",
4725+
... "2015-05-08",
4726+
... "2015-05-07",
4727+
... "2015-05-06",
4728+
... "2015-05-05",
4729+
... ],
4730+
... "Data": [5, 8, 6, 1, 50, 100, 60, 120],
4731+
... }
4732+
... }
4733+
... )
47244734
>>> df
47254735
Date Data
47264736
0 2015-05-08 5
@@ -4731,7 +4741,7 @@ def transform(
47314741
5 2015-05-07 100
47324742
6 2015-05-06 60
47334743
7 2015-05-05 120
4734-
>>> df.groupby('Date')['Data'].transform('sum')
4744+
>>> df.groupby("Date")["Data"].transform("sum")
47354745
0 55
47364746
1 108
47374747
2 66
@@ -4742,10 +4752,14 @@ def transform(
47424752
7 121
47434753
Name: Data, dtype: int64
47444754
4745-
>>> df = pd.DataFrame({{
4746-
... "c": [1, 1, 1, 2, 2, 2, 2],
4747-
... "type": ["m", "n", "o", "m", "m", "n", "n"]
4748-
... }})
4755+
>>> df = pd.DataFrame(
4756+
... {
4757+
... {
4758+
... "c": [1, 1, 1, 2, 2, 2, 2],
4759+
... "type": ["m", "n", "o", "m", "m", "n", "n"],
4760+
... }
4761+
... }
4762+
... )
47494763
>>> df
47504764
c type
47514765
0 1 m
@@ -4755,7 +4769,7 @@ def transform(
47554769
4 2 m
47564770
5 2 n
47574771
6 2 n
4758-
>>> df['size'] = df.groupby('c')['type'].transform(len)
4772+
>>> df["size"] = df.groupby("c")["type"].transform(len)
47594773
>>> df
47604774
c type size
47614775
0 1 m 3

0 commit comments

Comments
 (0)