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
- Dates read as plain textData Scientist
- Keeping the latest row per emailData Scientist
- Sorting by city then by salesData Scientist
- Getting the weekday from a date columnData Scientist