Skip to content

Commit

Permalink
write categorical directly to csv wo/ cast
Browse files Browse the repository at this point in the history
  • Loading branch information
ritchie46 committed Oct 10, 2021
1 parent 9dacd6d commit d731987
Showing 1 changed file with 0 additions and 15 deletions.
15 changes: 0 additions & 15 deletions polars/polars-io/src/csv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,21 +81,6 @@ where

fn finish(self, df: &DataFrame) -> Result<()> {
let mut writer = self.writer_builder.from_writer(self.buffer);

// temp coerce cat to utf8 until supported in csv writer
let columns = df
.get_columns()
.iter()
.map(|s| {
if let DataType::Categorical = s.dtype() {
s.cast(&DataType::Utf8).unwrap()
} else {
s.clone()
}
})
.collect();
let df = DataFrame::new_no_checks(columns);

let iter = df.iter_record_batches();
write::write_header(&mut writer, &df.schema().to_arrow())?;
for batch in iter {
Expand Down

0 comments on commit d731987

Please sign in to comment.