I suggest it might also be useful for PintArrays. When we have a column of a dataframe that's np.float64 type and we map a function across that, we get back a series that's np.float64. But when we have a column that wraps a PintArray and we map a function across that that preserves the Quantity type, we get back a series that's dtype='object'.
I tried making sense of how categories and sparse things use map, but I'm just not up to speed on those parts of pandas. But I do think that it would be SUPER if, when applying quantity-preserving transformations to Series that contain PintArrays, we could preserve the PintArray and its Quantity dtype.
Gnostic sources of pandas ExtensionArrays mention that implementing .map() might be useful: https://github.com/pandas-dev/pandas/issues/23179
I suggest it might also be useful for PintArrays. When we have a column of a dataframe that's np.float64 type and we map a function across that, we get back a series that's np.float64. But when we have a column that wraps a PintArray and we map a function across that that preserves the Quantity type, we get back a series that's dtype='object'.
I tried making sense of how categories and sparse things use map, but I'm just not up to speed on those parts of pandas. But I do think that it would be SUPER if, when applying quantity-preserving transformations to Series that contain PintArrays, we could preserve the PintArray and its Quantity dtype.