Skip to content

DataFrame does not work well with quantities #1071

Closed
@tkf

Description

@tkf
from pandas import DataFrame
import quantities as pq
df = DataFrame([[pq.Quantity(i, pq.s)] for i in range(3)])
df[1:] - df[:-1]

raises: ValueError: Unable to convert between units of "dimensionless" and "s"

Note that the following works w/o error because pandas "strips" dimension:

df = DataFrame(pq.Quantity(np.array([0,1,2]).T, pq.s))
df[1:] - df[:-1]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions