Skip to content

Commit ab9f0d7

Browse files
code sample for pandas-dev#45836
1 parent 687a41b commit ab9f0d7

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

bisect/45836.py

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# BUG: Pandas 1.4.0 - pd.NaT can not be replaced. #45836
2+
3+
import numpy as np
4+
import pandas as pd
5+
6+
print(pd.__version__)
7+
8+
df = pd.DataFrame([pd.NaT, pd.NaT])
9+
result = df.replace({pd.NaT: None, np.NaN: None})
10+
print(result)
11+
# Either pd.NaT or pd.np.NaN work in 1.3.5
12+
13+
expected = pd.DataFrame([None, None])
14+
15+
pd.testing.assert_frame_equal(result, expected)
16+

0 commit comments

Comments
 (0)