Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
Ask Question
When I reproduce the example with named aggregation of a dataframe from the documentation I get an error.
Docs:
https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.aggregate.html
I am running Spyder 4.2.5 with Python 3.7 and also get the same error on a different computer with Python 3.8 and Jupyter Notebook with Python 3. Pandas version 1.0.5.
Reproduceable code:
import pandas as pd
import numpy as np
df = pd.DataFrame([[1, 2, 3],
[4, 5, 6],
[7, 8, 9],
[np.nan, np.nan, np.nan]],
columns=['A', 'B', 'C'])
df.agg(x=('A', max), y=('B', 'min'), z=('C', np.mean))
What am I missing?
Output:
TypeError: aggregate() missing 1 required positional argument: 'func'
Disclaimer: First post on stackoverflow
–
–
–
–
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.