示例#1
0
文件: test_sas.py 项目: wjt/pandas
    def test1_index(self):
        # Tests with DEMO_G.xpt using index (all numeric file)

        # Compare to this
        data_csv = pd.read_csv(self.file01.replace(".xpt", ".csv"))
        data_csv = data_csv.set_index("SEQN")
        numeric_as_float(data_csv)

        # Read full file
        data = XportReader(self.file01, index="SEQN").read()
        tm.assert_frame_equal(data, data_csv, check_index_type=False)

        # Test incremental read with `read` method.
        reader = XportReader(self.file01, index="SEQN")
        data = reader.read(10)
        tm.assert_frame_equal(data,
                              data_csv.iloc[0:10, :],
                              check_index_type=False)

        # Test incremental read with `get_chunk` method.
        reader = XportReader(self.file01, index="SEQN", chunksize=10)
        data = reader.get_chunk()
        tm.assert_frame_equal(data,
                              data_csv.iloc[0:10, :],
                              check_index_type=False)
示例#2
0
    def test1_index(self):
        # Tests with DEMO_G.XPT using index (all numeric file)

        # Compare to this
        data_csv = pd.read_csv(self.file01.replace(".XPT", ".csv"))
        data_csv = data_csv.set_index("SEQN")
        numeric_as_float(data_csv)

        # Read full file
        data = XportReader(self.file01, index="SEQN").read()
        tm.assert_frame_equal(data, data_csv, check_index_type=False)

        # Test incremental read with `read` method.
        reader = XportReader(self.file01, index="SEQN")
        data = reader.read(10)
        tm.assert_frame_equal(data, data_csv.iloc[0:10, :], check_index_type=False)

        # Test incremental read with `get_chunk` method.
        reader = XportReader(self.file01, index="SEQN", chunksize=10)
        data = reader.get_chunk()
        tm.assert_frame_equal(data, data_csv.iloc[0:10, :], check_index_type=False)
示例#3
0
文件: test_sas.py 项目: wjt/pandas
    def test1_basic(self):
        # Tests with DEMO_G.xpt (all numeric file)

        # Compare to this
        data_csv = pd.read_csv(self.file01.replace(".xpt", ".csv"))
        numeric_as_float(data_csv)

        # Read full file
        data = XportReader(self.file01).read()
        tm.assert_frame_equal(data, data_csv)

        # Test incremental read with `read` method.
        reader = XportReader(self.file01)
        data = reader.read(10)
        tm.assert_frame_equal(data, data_csv.iloc[0:10, :])

        # Test incremental read with `get_chunk` method.
        reader = XportReader(self.file01, chunksize=10)
        data = reader.get_chunk()
        tm.assert_frame_equal(data, data_csv.iloc[0:10, :])

        # Read full file with `read_sas` method
        data = read_sas(self.file01)
        tm.assert_frame_equal(data, data_csv)
示例#4
0
    def test1(self):
        # Tests with DEMO_G.XPT (all numeric file)

        # Compare to this
        data_csv = pd.read_csv(self.file01.replace(".XPT", ".csv"))
        numeric_as_float(data_csv)

        # Read full file
        data = XportReader(self.file01).read()
        tm.assert_frame_equal(data, data_csv)

        # Test incremental read with `read` method.
        reader = XportReader(self.file01)
        data = reader.read(10)
        tm.assert_frame_equal(data, data_csv.iloc[0:10, :])

        # Test incremental read with `get_chunk` method.
        reader = XportReader(self.file01, chunksize=10)
        data = reader.get_chunk()
        tm.assert_frame_equal(data, data_csv.iloc[0:10, :])

        # Read full file with `read_sas` method
        data = read_sas(self.file01)
        tm.assert_frame_equal(data, data_csv)