@@ -614,12 +614,12 @@ def test_list_grouper_with_nat(self):
614
614
615
615
# Grouper in a list grouping
616
616
result = df .groupby ([grouper ])
617
- expected = {pd . Timestamp ("2011-01-01" ): Index (list (range (364 )))}
617
+ expected = {Timestamp ("2011-01-01" ): Index (list (range (364 )))}
618
618
tm .assert_dict_equal (result .groups , expected )
619
619
620
620
# Test case without a list
621
621
result = df .groupby (grouper )
622
- expected = {pd . Timestamp ("2011-01-01" ): 365 }
622
+ expected = {Timestamp ("2011-01-01" ): 365 }
623
623
tm .assert_dict_equal (result .groups , expected )
624
624
625
625
@pytest .mark .parametrize (
@@ -938,12 +938,12 @@ def test_groupby_with_small_elem(self):
938
938
grouped = df .groupby ([pd .Grouper (freq = "M" ), "event" ])
939
939
assert len (grouped .groups ) == 2
940
940
assert grouped .ngroups == 2
941
- assert (pd . Timestamp ("2014-09-30" ), "start" ) in grouped .groups
942
- assert (pd . Timestamp ("2013-10-31" ), "start" ) in grouped .groups
941
+ assert (Timestamp ("2014-09-30" ), "start" ) in grouped .groups
942
+ assert (Timestamp ("2013-10-31" ), "start" ) in grouped .groups
943
943
944
- res = grouped .get_group ((pd . Timestamp ("2014-09-30" ), "start" ))
944
+ res = grouped .get_group ((Timestamp ("2014-09-30" ), "start" ))
945
945
tm .assert_frame_equal (res , df .iloc [[0 ], :])
946
- res = grouped .get_group ((pd . Timestamp ("2013-10-31" ), "start" ))
946
+ res = grouped .get_group ((Timestamp ("2013-10-31" ), "start" ))
947
947
tm .assert_frame_equal (res , df .iloc [[1 ], :])
948
948
949
949
df = DataFrame (
@@ -953,12 +953,12 @@ def test_groupby_with_small_elem(self):
953
953
grouped = df .groupby ([pd .Grouper (freq = "M" ), "event" ])
954
954
assert len (grouped .groups ) == 2
955
955
assert grouped .ngroups == 2
956
- assert (pd . Timestamp ("2014-09-30" ), "start" ) in grouped .groups
957
- assert (pd . Timestamp ("2013-10-31" ), "start" ) in grouped .groups
956
+ assert (Timestamp ("2014-09-30" ), "start" ) in grouped .groups
957
+ assert (Timestamp ("2013-10-31" ), "start" ) in grouped .groups
958
958
959
- res = grouped .get_group ((pd . Timestamp ("2014-09-30" ), "start" ))
959
+ res = grouped .get_group ((Timestamp ("2014-09-30" ), "start" ))
960
960
tm .assert_frame_equal (res , df .iloc [[0 , 2 ], :])
961
- res = grouped .get_group ((pd . Timestamp ("2013-10-31" ), "start" ))
961
+ res = grouped .get_group ((Timestamp ("2013-10-31" ), "start" ))
962
962
tm .assert_frame_equal (res , df .iloc [[1 ], :])
963
963
964
964
# length=3
@@ -969,15 +969,15 @@ def test_groupby_with_small_elem(self):
969
969
grouped = df .groupby ([pd .Grouper (freq = "M" ), "event" ])
970
970
assert len (grouped .groups ) == 3
971
971
assert grouped .ngroups == 3
972
- assert (pd . Timestamp ("2014-09-30" ), "start" ) in grouped .groups
973
- assert (pd . Timestamp ("2013-10-31" ), "start" ) in grouped .groups
974
- assert (pd . Timestamp ("2014-08-31" ), "start" ) in grouped .groups
972
+ assert (Timestamp ("2014-09-30" ), "start" ) in grouped .groups
973
+ assert (Timestamp ("2013-10-31" ), "start" ) in grouped .groups
974
+ assert (Timestamp ("2014-08-31" ), "start" ) in grouped .groups
975
975
976
- res = grouped .get_group ((pd . Timestamp ("2014-09-30" ), "start" ))
976
+ res = grouped .get_group ((Timestamp ("2014-09-30" ), "start" ))
977
977
tm .assert_frame_equal (res , df .iloc [[0 ], :])
978
- res = grouped .get_group ((pd . Timestamp ("2013-10-31" ), "start" ))
978
+ res = grouped .get_group ((Timestamp ("2013-10-31" ), "start" ))
979
979
tm .assert_frame_equal (res , df .iloc [[1 ], :])
980
- res = grouped .get_group ((pd . Timestamp ("2014-08-31" ), "start" ))
980
+ res = grouped .get_group ((Timestamp ("2014-08-31" ), "start" ))
981
981
tm .assert_frame_equal (res , df .iloc [[2 ], :])
982
982
983
983
def test_grouping_string_repr (self ):
0 commit comments