medium10 pts · first answer countspandasmissing-data
groupby with a missing key
What does this code print?
import pandas as pd
df = pd.DataFrame({'g': ['x', None, 'x', 'y'], 'v': [1, 2, 3, 4]})
print(df.groupby('g')['v'].sum().to_dict())Discussion 0
Join free to post in the discussion.
Related questions
- Counting missing values in pandasData Scientist
- pandas mean with a missing valueData Scientist
- value_counts with normalizeData Scientist
- COUNT of a column with NULLsData Scientist
- groupby with transformData Scientist
- Row count after a mergeData Scientist
- NOT IN returns no rowsData Scientist
- Rolling mean at the edgesData Scientist