| 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 |