We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c28c589 commit 6e61cf4Copy full SHA for 6e61cf4
pandas/tests/groupby/test_groupby.py
@@ -2978,3 +2978,21 @@ def test_groupby_multi_index_codes():
2978
2979
index = df_grouped.index
2980
tm.assert_index_equal(index, MultiIndex.from_frame(index.to_frame()))
2981
+
2982
2983
+def test_groupby_datetime_with_nat():
2984
+ # GH##35202
2985
+ df = DataFrame(
2986
+ {
2987
+ "a": [
2988
+ to_datetime("2019-02-12"),
2989
2990
+ to_datetime("2019-02-13"),
2991
+ pd.NaT,
2992
+ ],
2993
+ "b": [1, 2, 3, 4],
2994
+ }
2995
+ )
2996
+ grouped = df.groupby("a", dropna=False)
2997
+ result = len(grouped)
2998
+ assert result == 3
0 commit comments