def test_st(self): df = UntypedDf().convert(pd.DataFrame(sample_data())) assert len(df[df["xyz"] == 6]) == 1 assert len(df.st(df["xyz"] == 6)) == 1 assert len(df.st(xyz=6)) == 1 assert len(df.st(df["xyz"] == 6, df["xyz"] == 6)) == 1 assert len(df.st(df["xyz"] == 6, df["xyz"] == 3)) == 0 assert len(df.st(df["xyz"] == 6, xyz=6)) == 1 assert len(df.st(df["xyz"] == 6, xyz=2)) == 0 assert len(df.st(xyz=1, abc=1)) == 0 assert len(df.st(df["xyz"] == 6, df["xyz"] == 1, xyz=6)) == 0
def test_pretty(self): assert (UntypedDf()._repr_html_().startswith( "<strong>UntypedDf: 0 rows × 0 columns</strong>"))
def test_write_passing_index(self): with tmpfile(".csv") as path: df = Trivial(sample_data()) df.to_csv(path, index=["abc"]) # fine df = UntypedDf(sample_data()) df.to_csv(path, index=["abc"]) # calls super immediately
def test_records(self): df = UntypedDf(sample_data()) records = df.to_records() df2 = UntypedDf.from_records(records) assert isinstance(df2, UntypedDf)
def test_pretty(self): assert (UntypedDf()._repr_html_().startswith( "<strong>UntypedDf: 0 rows × 0 columns</strong>")) df = UntypedDf(sample_data()).set_index(["abc", "123"]) assert (UntypedDf(df)._repr_html_().startswith( "<strong>UntypedDf: 2 rows × 1 columns, 2 index columns</strong>"))