Skip to content

Commit 0ac714a

Browse files
authored
[DataFrame] - Add write_csv/write_parquet/write_json to DataFrame (#58)
1 parent 0b00c6f commit 0ac714a

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

src/dataframe.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,4 +234,22 @@ impl PyDataFrame {
234234
let new_df = self.df.except(py_df.df)?;
235235
Ok(Self::new(new_df))
236236
}
237+
238+
/// Write a `DataFrame` to a CSV file.
239+
fn write_csv(&self, path: &str, py: Python) -> PyResult<()> {
240+
wait_for_future(py, self.df.write_csv(path))?;
241+
Ok(())
242+
}
243+
244+
/// Write a `DataFrame` to a Parquet file.
245+
fn write_parquet(&self, path: &str, py: Python) -> PyResult<()> {
246+
wait_for_future(py, self.df.write_parquet(path, None))?;
247+
Ok(())
248+
}
249+
250+
/// Executes a query and writes the results to a partitioned JSON file.
251+
fn write_json(&self, path: &str, py: Python) -> PyResult<()> {
252+
wait_for_future(py, self.df.write_json(path))?;
253+
Ok(())
254+
}
237255
}

0 commit comments

Comments
 (0)