예제 #1
0
파일: test_gbq.py 프로젝트: nicku33/pandas
    def test_that_parse_data_works_properly(self):
        test_schema = {'fields': [{'mode': 'NULLABLE', 'name': 'VALID_STRING', 'type': 'STRING'}]}
        test_page = [{'f': [{'v': 'PI'}]}]

        test_output = gbq._parse_data(test_schema, test_page)
        correct_output = DataFrame({'VALID_STRING': ['PI']})
        tm.assert_frame_equal(test_output, correct_output)
예제 #2
0
    def test_that_parse_data_works_properly(self):
        test_schema = {'fields': [{'mode': 'NULLABLE', 'name': 'VALID_STRING', 'type': 'STRING'}]}
        test_page = [{'f': [{'v': 'PI'}]}]

        test_output = gbq._parse_data(test_schema, test_page)
        correct_output = DataFrame({'VALID_STRING': ['PI']})
        tm.assert_frame_equal(test_output, correct_output)
예제 #3
0
파일: test_gbq.py 프로젝트: cscanlin/pandas
    def test_that_parse_data_works_properly(self):
        test_schema = {"fields": [{"mode": "NULLABLE", "name": "VALID_STRING", "type": "STRING"}]}
        test_page = [{"f": [{"v": "PI"}]}]

        test_output = gbq._parse_data(test_schema, test_page)
        correct_output = DataFrame({"VALID_STRING": ["PI"]})
        tm.assert_frame_equal(test_output, correct_output)
예제 #4
0
파일: test_gbq.py 프로젝트: t1c1/pandas
 def test_index_column(self):
     # A user should be able to specify an index column for return
     result_frame = gbq._parse_data(FakeClient(),
                                    self.fake_job,
                                    index_col='word')
     correct_frame = DataFrame(self.correct_data_small)
     correct_frame.set_index('word', inplace=True)
     self.assertTrue(result_frame.index.name == correct_frame.index.name)
예제 #5
0
파일: test_gbq.py 프로젝트: t1c1/pandas
 def test_column_order(self):
     # A User should be able to specify the order in which columns are returned in the dataframe
     col_order = ['corpus_date', 'word_count', 'corpus', 'word']
     result_frame = gbq._parse_data(FakeClient(),
                                    self.fake_job,
                                    col_order=col_order)
     tm.assert_index_equal(
         result_frame.columns,
         DataFrame(self.correct_data_small)[col_order].columns)
예제 #6
0
파일: test_gbq.py 프로젝트: akloster/pandas
 def test_column_order_plus_index(self):
     # A User should be able to specify an index and the order of THE REMAINING columns.. they should be notified
     # if they screw up
     col_order = ['corpus_date', 'word', 'corpus']
     result_frame = gbq._parse_data(FakeClient(), self.fake_job, index_col='word_count', col_order=col_order)
     correct_frame_small = DataFrame(self.correct_data_small)
     correct_frame_small.set_index('word_count',inplace=True)
     correct_frame_small = DataFrame(correct_frame_small)[col_order]
     tm.assert_index_equal(result_frame.columns, correct_frame_small.columns)
예제 #7
0
파일: test_gbq.py 프로젝트: t1c1/pandas
 def test_column_order_plus_index(self):
     # A User should be able to specify an index and the order of THE REMAINING columns.. they should be notified
     # if they screw up
     col_order = ['corpus_date', 'word', 'corpus']
     result_frame = gbq._parse_data(FakeClient(),
                                    self.fake_job,
                                    index_col='word_count',
                                    col_order=col_order)
     correct_frame_small = DataFrame(self.correct_data_small)
     correct_frame_small.set_index('word_count', inplace=True)
     correct_frame_small = DataFrame(correct_frame_small)[col_order]
     tm.assert_index_equal(result_frame.columns,
                           correct_frame_small.columns)
예제 #8
0
파일: test_gbq.py 프로젝트: akloster/pandas
 def test_column_order(self):
     # A User should be able to specify the order in which columns are returned in the dataframe    
     col_order = ['corpus_date', 'word_count', 'corpus', 'word']
     result_frame = gbq._parse_data(FakeClient(), self.fake_job, col_order=col_order)
     tm.assert_index_equal(result_frame.columns, DataFrame(self.correct_data_small)[col_order].columns)
예제 #9
0
파일: test_gbq.py 프로젝트: akloster/pandas
 def test_index_column(self):
     # A user should be able to specify an index column for return     
     result_frame = gbq._parse_data(FakeClient(), self.fake_job, index_col='word')
     correct_frame = DataFrame(self.correct_data_small)
     correct_frame.set_index('word', inplace=True)
     self.assertTrue(result_frame.index.name == correct_frame.index.name)