Skip to content

Commit 10938b9

Browse files
bmorris3taldcroft
authored andcommitted
Adding pandas Int64 support [fix astropy#9280]
1 parent 5ff936b commit 10938b9

1 file changed

Lines changed: 2 additions & 5 deletions

File tree

‎astropy/table/table.py‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3353,7 +3353,7 @@ def to_pandas(self, index=None):
33533353
2002-01-01 2.0 6.0 8.0 00:03:20
33543354
33553355
"""
3356-
from pandas import DataFrame
3356+
from pandas import DataFrame, Series
33573357

33583358
if index is not False:
33593359
if index in (None, True):
@@ -3417,10 +3417,7 @@ def _encode_mixins(tbl):
34173417
for name, column in tbl.columns.items():
34183418
if isinstance(column, MaskedColumn) and np.any(column.mask):
34193419
if column.dtype.kind in ['i', 'u']:
3420-
out[name] = column.astype(float).filled(np.nan)
3421-
warnings.warn(
3422-
"converted column '{}' from integer to float".format(
3423-
name), TableReplaceWarning, stacklevel=3)
3420+
out[name] = Series(column, dtype='Int64')
34243421
elif column.dtype.kind in ['f', 'c']:
34253422
out[name] = column.filled(np.nan)
34263423
else:

0 commit comments

Comments
 (0)