Skip to content
RED SAGSkills
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())
Choose one answer

Discussion 0

Join free to post in the discussion.

Related questions