Flexible and powerful data analysis / manipulation library for Python, providing labeled data structures similar to R data.frame objects, statistical functions, and much more
When the pd.read_excel function encounters an empty cell with a numeric dtype, it leads to a conversion error. The solution to this, is to use the Pandas specific nullable numeric types, which work extremely well. The problem is that these datatypes are hard to access via strings. pd.read_excel is especially keen on interpreting strings as numpy datatypes, while pd.api.types.pandas_dtype is capable of returning pandas dtypes, but it's unclear what this is based on.
Feature Description
Since the pandas dtypes often have several advantages over their numpy counterparts, it would make sense that functions which are capable of interpreting strings as datatypes have a flag, which forces them (if possible) to interpret strings as pandas datatypes and not their numpy counterparts.
Alternative Solutions
A workaround for now, is to run every datatype through the pd.api.types.pandas_dtype function, with very specific capitalization.
Running:
type(pd.api.types.pandas_dtype("Int64"))
Returns:
<class 'pandas.core.arrays.integer.Int64Dtype'>
Which is good, but running:
type(pd.api.types.pandas_dtype("int64"))
Returns:
<class 'numpy.dtypes.Int64DType'>
So while this is technically a solution, trying to use the pandas interpreter for input from a user who doesn't have intricate knowledge of the issue is not possible.
Feature Type
[X] Adding new functionality to pandas
[ ] Changing existing functionality in pandas
[ ] Removing existing functionality in pandas
Problem Description
When the pd.read_excel function encounters an empty cell with a numeric dtype, it leads to a conversion error. The solution to this, is to use the Pandas specific nullable numeric types, which work extremely well. The problem is that these datatypes are hard to access via strings. pd.read_excel is especially keen on interpreting strings as numpy datatypes, while pd.api.types.pandas_dtype is capable of returning pandas dtypes, but it's unclear what this is based on.
Feature Description
Since the pandas dtypes often have several advantages over their numpy counterparts, it would make sense that functions which are capable of interpreting strings as datatypes have a flag, which forces them (if possible) to interpret strings as pandas datatypes and not their numpy counterparts.
Alternative Solutions
A workaround for now, is to run every datatype through the pd.api.types.pandas_dtype function, with very specific capitalization. Running: type(pd.api.types.pandas_dtype("Int64")) Returns: <class 'pandas.core.arrays.integer.Int64Dtype'> Which is good, but running: type(pd.api.types.pandas_dtype("int64")) Returns: <class 'numpy.dtypes.Int64DType'> So while this is technically a solution, trying to use the pandas interpreter for input from a user who doesn't have intricate knowledge of the issue is not possible.
Additional Context
No response