Python for Data Analysis: Data Wrangling with Pandas, NumPy, and IPython by Wes McKinney

Python for Data Analysis: Data Wrangling with Pandas, NumPy, and IPython by Wes McKinney

Author:Wes McKinney [McKinney, Wes]
Language: eng
Format: azw3, epub, pdf
Publisher: O'Reilly Media
Published: 2017-09-25T04:00:00+00:00


In [14]: grouped.mean() Out[14]: key1 a 0.746672 b -0.537585 Name: data1, dtype: float64

Later, I’ll explain more about what happens when you call .mean(). The important thing here is that the data (a Series) has been aggregated according to the group key, producing a new Series that is now indexed by the unique values in the key1 column. The result index has the name 'key1' because the DataFrame column df['key1'] did.

If instead we had passed multiple arrays as a list, we’d get something different:



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.