I want to set skipna=False when I use the agg method on a DataFrame.
My DataFrame has many (dynamic) columns. I'm performing groupby and aggregating using agg, like
import pandas as pd
import numpy as np
df = pd.DataFrame({"A": [1, 2], "B": [np.nan, np.nan], "C": [0, 0]})
# the sum of B is 0.0
df.agg({"A": "sum", "B": "sum", "C": "max"})
When I'm aggregating a single column, or using a single aggregation function across the entire DataFrame, I can add skipna=False so that the nan values aren't skipped, i.e.
df["B"].sum(skipna=False) or df.sum(skipna=False). This doesn't work for me because I'm doing a bunch of different functions (sum, avg, max).
How can I pass that skipna argument via the agg method?