コード例 #1
0
ファイル: test_sas.py プロジェクト: wjt/pandas
    def test_multiple_types(self):
        # Test with DRXFCD_G.xpt (contains text and numeric variables)

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

        data = XportReader(self.file03).read()
        tm.assert_frame_equal(data, data_csv)

        data = read_sas(self.file03)
        tm.assert_frame_equal(data, data_csv)
コード例 #2
0
ファイル: test_sas.py プロジェクト: GuillaumeDec/stratifi-api
    def test3(self):
        # Test with DRXFCD_G.XPT (contains text and numeric variables)

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

        data = XportReader(self.file03).read()
        tm.assert_frame_equal(data, data_csv)

        data = read_sas(self.file03)
        tm.assert_frame_equal(data, data_csv)
コード例 #3
0
ファイル: test_sas.py プロジェクト: wjt/pandas
    def test_truncated_float_support(self):
        # Test with paxraw_d_short.xpt, a shortened version of:
        # http://wwwn.cdc.gov/Nchs/Nhanes/2005-2006/PAXRAW_D.ZIP
        # This file has truncated floats (5 bytes in this case).

        # GH 11713

        data_csv = pd.read_csv(self.file04.replace(".xpt", ".csv"))

        data = XportReader(self.file04).read()
        tm.assert_frame_equal(data.astype('int64'), data_csv)

        data = read_sas(self.file04)
        tm.assert_frame_equal(data.astype('int64'), data_csv)
コード例 #4
0
ファイル: test_sas.py プロジェクト: troglotit/pandas
    def test_truncated_float_support(self):
        # Test with paxraw_d_short.xpt, a shortened version of:
        # http://wwwn.cdc.gov/Nchs/Nhanes/2005-2006/PAXRAW_D.ZIP
        # This file has truncated floats (5 bytes in this case).

        # GH 11713

        data_csv = pd.read_csv(self.file04.replace(".xpt", ".csv"))

        data = XportReader(self.file04).read()
        tm.assert_frame_equal(data.astype("int64"), data_csv)

        data = read_sas(self.file04)
        tm.assert_frame_equal(data.astype("int64"), data_csv)
コード例 #5
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)
コード例 #6
0
ファイル: test_sas.py プロジェクト: GuillaumeDec/stratifi-api
    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)