-
-
Notifications
You must be signed in to change notification settings - Fork 18.8k
Closed
Labels
Compatpandas objects compatability with Numpy or Python functionspandas objects compatability with Numpy or Python functionsDtype ConversionsUnexpected or buggy dtype conversionsUnexpected or buggy dtype conversions
Milestone
Description
Common dtype discovery (like np.find_common_type
) should be unified into an internal function, with proper handling of pandas
dtypes. As of #13917, there are two such implementations:
pandas/types/common.py:_lcd_dtypes
, which works onnumpy
dtypes only, but differently thannp.find_common_type
.pandas/types/cast.py:_find_common_type
, which just usesnp.find_common_type
internally.
Exchanging the first one with the second (which is, judging by the code, more proper), breaks some tests.
Proposed tasks:
- Convert usages of
_lcd_dtypes
into_find_common_types
. - Extend
_find_common_types
to properly evaluatepandas
dtypes.
Occurences of _lcd_dtypes
, the one in internals.py
is removed by #13917:
[jreback-~/pandas] grin _lcd_dtype pandas
pandas/core/frame.py:
47 : _lcd_dtypes,
3705 : new_dtype = _lcd_dtypes(this_dtype, other_dtype)
pandas/core/internals.py:
4438 : def _lcd_dtype(l):
4473 : lcd = _lcd_dtype(counts[IntBlock])
4489 : return _lcd_dtype(counts[FloatBlock] + counts[SparseBlock])
pandas/types/common.py:
389 : def _lcd_dtypes(a_dtype, b_dtype):
sinhrks
Metadata
Metadata
Assignees
Labels
Compatpandas objects compatability with Numpy or Python functionspandas objects compatability with Numpy or Python functionsDtype ConversionsUnexpected or buggy dtype conversionsUnexpected or buggy dtype conversions