You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a PintArray in a Dataframe column and I want to calculate the rolling sum and put the values in a new column. The resulting column is an array of floats instead of a PintArray. Is there a way that I can perform the calculation so that the result is a PintArray?
`import numpy as np
import pandas as pd
import pint
import pint_pandas
I have a PintArray in a Dataframe column and I want to calculate the rolling sum and put the values in a new column. The resulting column is an array of floats instead of a PintArray. Is there a way that I can perform the calculation so that the result is a PintArray?
`import numpy as np
import pandas as pd
import pint
import pint_pandas
df = pd.DataFrame(pint_pandas.PintArray(np.arange(10), dtype='pint[in]'), columns = ['A'])
df['B'] = df['A'].rolling(2).sum()
print(df.dtypes)
`
The text was updated successfully, but these errors were encountered: