8000 "ValueError: fill_value must be a scalar" when concatenating columns requiring fill · Issue #165 · hgrecco/pint-pandas · GitHub
[go: up one dir, main page]

Skip to content
"ValueError: fill_value must be a scalar" when concatenating columns requiring fill #165
@burnpanck

Description

@burnpanck

The following MWE shows the issue:

import pandas as pd
import pint_pandas

a = pd.Series(index=[1,2],data=pint_pandas.PintArray([0.,1.], u.mm))
b = pd.Series(index=[2,3],data=pint_pandas.PintArray([2.,3.], u.s))

pd.concat([a,b],axis="columns")

With "normal" pint columns, the code works as expected. I partially traced the error down to

fill_value = fill_value.to(self.units).magnitude

which seems to create a 0-d numpy array instead of a numpy scalar.

This may be an impact of a recent change in either pint_pandas or numpy; I already observed that my int(round(some_quantity/other_quantity_of_same_dim)) started to fail and now require a int(round(float(...))) construct.

The relevant versions in my environment are:

numpy: 1.23.5
pandas: 1.5.1
pint: 0.20.1
pint_pandas: 0.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0