Closed
Description
The read_sql()
docs say for the new dtype
argument:
dtype Type name or dict of columns
Data type for data or columns. E.g. np.float64 or {‘a’: np.float64, ‘b’: np.int32, ‘c’: ‘Int64’}. The argument is ignored if a table is passed instead of a query.
But in the typing in the source code, the argument is DtypeArg | None
which doesn't allow something like {"c": "str"}
. The implementation just passes dtype
to DataFrame.astype()
.
See pandas-dev/pandas-stubs#676
NOTE: In pandas-stubs
we did work to create all the possible strings and dtypes for astype()
, so maybe that should be copied over to the pandas source??