Pandas nullable integers: Keeping ints with Int64 and pd.NA

Pandas nullable integers: Keeping ints with Int64 and pd.NA

You have a Python Pandas series with ints + NaN. You don’t want float forced on you.

Solution: Use the “extension” type Int64 (note Initial Caps) and pd.NA:

s = Series([10, pd.NA, 30], dtype='Int64')  # must name explicitly

s is:

0 10
1 <NA>
2 30
dtype: Int64