MCPcopy
hub / github.com/pandas-dev/pandas / test_basic

Method test_basic

pandas/tests/io/test_feather.py:68–105  ·  view source on GitHub ↗
(self, temp_file)

Source from the content-addressed store, hash-verified

66 self.check_error_on_write(obj, ValueError, msg, temp_file)
67
68 def test_basic(self, temp_file):
69 tz = zoneinfo.ZoneInfo("US/Eastern")
70 df = pd.DataFrame(
71 {
72 "string": list("abc"),
73 "int": list(range(1, 4)),
74 "uint": np.arange(3, 6).astype("u1"),
75 "float": np.arange(4.0, 7.0, dtype="float64"),
76 "float_with_null": [1.0, np.nan, 3],
77 "bool": [True, False, True],
78 "bool_with_null": [True, np.nan, False],
79 "cat": pd.Categorical(list("abc")),
80 "dt": pd.DatetimeIndex(
81 list(pd.date_range("20130101", periods=3)), freq=None
82 ),
83 "dttz": pd.DatetimeIndex(
84 list(pd.date_range("20130101", periods=3, tz=tz)),
85 freq=None,
86 ),
87 "dt_with_null": [
88 pd.Timestamp("20130101"),
89 pd.NaT,
90 pd.Timestamp("20130103"),
91 ],
92 "dtns": pd.DatetimeIndex(
93 list(pd.date_range("20130101", periods=3, freq="ns")), freq=None
94 ),
95 }
96 )
97 df["periods"] = pd.period_range("2013", freq="M", periods=3)
98 df["timedeltas"] = pd.timedelta_range("1 day", periods=3)
99 df["intervals"] = pd.interval_range(0, 3, 3)
100
101 assert df.dttz.dtype.tz.key == "US/Eastern"
102
103 expected = df.copy()
104 expected.loc[1, "bool_with_null"] = None
105 self.check_round_trip(df, temp_file, expected=expected)
106
107 def test_duplicate_columns(self, temp_file):
108 # https://github.com/wesm/feather/issues/53

Callers

nothing calls this directly

Calls 3

check_round_tripMethod · 0.95
astypeMethod · 0.45
copyMethod · 0.45

Tested by

no test coverage detected