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

Method test1_index

pandas/tests/io/sas/test_xport.py:62–83  ·  view source on GitHub ↗
(self, datapath)

Source from the content-addressed store, hash-verified

60 tm.assert_frame_equal(data, data_csv)
61
62 def test1_index(self, datapath):
63 # Tests with DEMO_G.xpt using index (all numeric file)
64
65 # Compare to this
66 file01 = datapath("io", "sas", "data", "DEMO_G.xpt")
67 data_csv = pd.read_csv(file01.replace(".xpt", ".csv"))
68 data_csv = data_csv.set_index("SEQN")
69 numeric_as_float(data_csv)
70
71 # Read full file
72 data = read_sas(file01, index="SEQN", format="xport")
73 tm.assert_frame_equal(data, data_csv, check_index_type=False)
74
75 # Test incremental read with `read` method.
76 with read_sas(file01, index="SEQN", format="xport", iterator=True) as reader:
77 data = reader.read(10)
78 tm.assert_frame_equal(data, data_csv.iloc[0:10, :], check_index_type=False)
79
80 # Test incremental read with `get_chunk` method.
81 with read_sas(file01, index="SEQN", format="xport", chunksize=10) as reader:
82 data = reader.get_chunk()
83 tm.assert_frame_equal(data, data_csv.iloc[0:10, :], check_index_type=False)
84
85 def test1_incremental(self, datapath):
86 # Test with DEMO_G.xpt, reading full file incrementally

Callers

nothing calls this directly

Calls 8

read_sasFunction · 0.90
datapathFunction · 0.85
numeric_as_floatFunction · 0.85
set_indexMethod · 0.80
read_csvMethod · 0.45
replaceMethod · 0.45
readMethod · 0.45
get_chunkMethod · 0.45

Tested by

no test coverage detected