Skip to content

Commit

Permalink
[DataFrame] - Add write_csv/write_parquet/write_json to DataFrame (#58)
Browse files Browse the repository at this point in the history
  • Loading branch information
francis-du authored Oct 13, 2022
1 parent 0b00c6f commit 0ac714a
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/dataframe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,4 +234,22 @@ impl PyDataFrame {
let new_df = self.df.except(py_df.df)?;
Ok(Self::new(new_df))
}

/// Write a `DataFrame` to a CSV file.
fn write_csv(&self, path: &str, py: Python) -> PyResult<()> {
wait_for_future(py, self.df.write_csv(path))?;
Ok(())
}

/// Write a `DataFrame` to a Parquet file.
fn write_parquet(&self, path: &str, py: Python) -> PyResult<()> {
wait_for_future(py, self.df.write_parquet(path, None))?;
Ok(())
}

/// Executes a query and writes the results to a partitioned JSON file.
fn write_json(&self, path: &str, py: Python) -> PyResult<()> {
wait_for_future(py, self.df.write_json(path))?;
Ok(())
}
}

0 comments on commit 0ac714a

Please sign in to comment.