예제 #1
0
 def test_rewrite_conflicting_column_headers(self):
     with _temp_csv("A,A,Column 4,\na,b,c,d") as path:
         result = _internal_parse_csv(path, has_header=True)
         assert_csv_result_equals(
             result,
             ParseCsvResult(
                 pa.table({
                     "A": ["a"],
                     "A 2": ["b"],  # rewritten
                     "Column 4": ["c"],
                     "Column 5": ["d"],  # rewritten
                 }),
                 [ParseCsvWarning.NumberedColumnNames(2, "A 2")],
             ),
         )
예제 #2
0
 def test_truncate_column_names(self):
     with _temp_csv("ABC,ABCD,ABCDE,BCDEF\na,b,c,d") as path:
         assert_csv_result_equals(
             _internal_parse_csv(path, has_header=True),
             ParseCsvResult(
                 pa.table({
                     "ABC": ["a"],
                     "ABCD": ["b"],
                     "AB 2": ["c"],
                     "BCDE": ["d"]
                 }),
                 [
                     ParseCsvWarning.TruncatedColumnNames(2, "AB 2"),
                     ParseCsvWarning.NumberedColumnNames(1, "AB 2"),
                 ],
             ),
         )