This section documents how arnio handles pandas nullable extension dtypes
during a from_pandas → arnio → to_pandas round-trip.
| pandas input dtype | Supported | NA sentinel | Round-trip output dtype | Notes |
|---|---|---|---|---|
Int64 |
✅ | pd.NA |
Int64 |
Nullable integer preserved |
UInt64 |
✅ (bounded) | pd.NA |
Int64 |
Values must fit in signed int64 |
Float64 |
✅ | pd.NA |
float64 |
Upcasts to native float |
boolean |
✅ | pd.NA |
boolean |
Nullable bool preserved |
string |
✅ | pd.NA |
string |
Nullable string preserved |
Note:
Float64(capital F) is the pandas nullable float extension dtype. After a round-trip it becomesfloat64(lowercase), the standard NumPy dtype. The values and null positions are preserved; only the container dtype changes.
import pandas as pd
import arnio as ar
df = pd.DataFrame({
"int_col": pd.array([1, 2, None], dtype="Int64"),
"float_col": pd.array([1.5, None, 3.7], dtype="Float64"),
"bool_col": pd.array([True, None, False], dtype="boolean"),
"str_col": pd.array(["a", None, "c"], dtype="string"),
})
frame = ar.from_pandas(df)
result = ar.to_pandas(frame)
print(result.dtypes)
# int_col Int64
# float_col float64 ← note: Float64 → float64
# bool_col boolean
# str_col stringpd.NAis preserved aspd.NAforInt64,boolean, andstringcolumns.pd.NAin aFloat64column becomesfloat('nan')/pd.isna()after round-trip because the output dtype is nativefloat64.
The following dtypes raise TypeError with a fix hint:
| pandas dtype | Error |
|---|---|
datetime64 |
Convert to string first: .astype(str) |
timedelta64 |
Convert to seconds: .dt.total_seconds() |
category |
Convert to string first: .astype(str) |
complex128 |
Convert to string: .apply(str) |
UInt64 values must fit within the signed 64-bit integer range
(0 to 9223372036854775807). Values exceeding this raise ValueError.