diff --git a/pandas/core/frame.py b/pandas/core/frame.py index 021c7b74adb7f..711b9cd5dbf36 100644 --- a/pandas/core/frame.py +++ b/pandas/core/frame.py @@ -9223,11 +9223,11 @@ def groupby( You could also assign a list of column names or a list of index names. >>> df = pd.DataFrame({ - ... "lev1": [1, 1, 1, 2, 2, 2], - ... "lev2": [1, 1, 2, 1, 1, 2], - ... "lev3": [1, 2, 1, 2, 1, 2], - ... "lev4": [1, 2, 3, 4, 5, 6], - ... "values": [0, 1, 2, 3, 4, 5]}) + ... "lev1": [1, 1, 1, 2, 2, 2], + ... "lev2": [1, 1, 2, 1, 1, 2], + ... "lev3": [1, 2, 1, 2, 1, 2], + ... "lev4": [1, 2, 3, 4, 5, 6], + ... "values": [0, 1, 2, 3, 4, 5]}) >>> df lev1 lev2 lev3 lev4 values 0 1 1 1 1 0 diff --git a/pandas/core/shared_docs.py b/pandas/core/shared_docs.py index 3369df5da4cba..49b380e0af01e 100644 --- a/pandas/core/shared_docs.py +++ b/pandas/core/shared_docs.py @@ -839,7 +839,7 @@ Consider a dataset containing food consumption in Argentina. >>> df = pd.DataFrame({{'consumption': [10.51, 103.11, 55.48], - ... 'co2_emissions': [37.2, 19.66, 1712]}}, + ... 'co2_emissions': [37.2, 19.66, 1712]}}, ... index=['Pork', 'Wheat Products', 'Beef']) >>> df @@ -904,7 +904,7 @@ Consider a dataset containing food consumption in Argentina. >>> df = pd.DataFrame({{'consumption': [10.51, 103.11, 55.48], - ... 'co2_emissions': [37.2, 19.66, 1712]}}, + ... 'co2_emissions': [37.2, 19.66, 1712]}}, ... index=['Pork', 'Wheat Products', 'Beef']) >>> df