Data Types & Missing Data
Every Series has a single data type for all its values, and Pandas figures it out for you. Understanding that — and how a single missing value can change it — saves a lot of confusion later.
1The dtype of a Series
The dtype simply tells you what kind of data is inside. Pandas sets it automatically by looking at your values:
- 🔢 Whole numbers →
int64 - 💧 Decimal numbers →
float64 - 🔤 Text (or a mix of types) →
object
Pandas reads your data and picks the type automatically. Watch what a single missing value does.
All whole numbers → Pandas uses int64.
2NaN — how Pandas marks a missing number
NaN ("Not a Number") comes from the NumPy library and is the main way Pandas marks a missing value. Here's the twist you saw in the widget: put a NaN into a Series of whole numbers, and the entire Series becomes float64.
3Using None instead of NaN
None is Python's general-purpose "nothing" value. When you drop None into a Series of numbers, Pandas helpfully converts it to NaN for you:
np.nan or None, a numeric Series stores it as NaN and quietly upgrades itself to float64.You create pd.Series([1, 2, np.nan, 4]). What is its dtype?
What happens to None inside a numeric Series?