test: update doctest to new pandas behavior#5788
test: update doctest to new pandas behavior#5788westonpace merged 2 commits intolance-format:mainfrom
Conversation
Review: LGTM ✓This is a minimal doctest fix to accommodate pandas 3 behavior changes:
No issues identified. |
| 0 1 a x | ||
| 1 2 x y | ||
| 2 3 y z | ||
| 3 4 z NaN |
There was a problem hiding this comment.
Does pandas use NaN to represent None now?
That's a little bit weird... esp column c is with type string
There was a problem hiding this comment.
That's a little bit weird... esp column c is with type string
+10000, it almost feels like a bug to me, not sure if there are any related discussions in pandas about it
There was a problem hiding this comment.
>>> import pandas as pd
>>> pd.DataFrame({"x": ["x", "y", "z"]})
x
0 x
1 y
2 z
>>> pd.DataFrame({"x": ["x", "y", None]})
x
0 x
1 y
2 NaNMaybe a pandas bug but 🤷 . I'll see if there are any tickets on pandas repo.
There was a problem hiding this comment.
It is intentional:
The main characteristic of the new string data type:
Inferred by default for string data (instead of object dtype)
The str dtype can only hold strings (or missing values), in contrast to object dtype. (setitem with non string fails)
The missing value sentinel is always NaN (np.nan) and follows the same missing value semantics as the other default dtypes.
|
Oh, please feel free to cherry pick this PR: #5789 |
Co-authored-by: Xuanwo <github@xuanwo.io>
Co-authored-by: Xuanwo <github@xuanwo.io>
Co-authored-by: Xuanwo <github@xuanwo.io>
Co-authored-by: Xuanwo <github@xuanwo.io>
No description provided.