Skip to content

Commit

Permalink
Update pandas.md
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilipMay authored Nov 19, 2023
1 parent c75c72b commit d462177
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion source/python/pandas.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,18 @@ df = pd.read_csv(

- load csv without header: `df = pd.read_csv("path_or_buffer", names=["column_name_1", "column_name_2"], header=None)`

## Load and Save Parquet
## Load and Save as Parquet

- save to parquet: `df.to_parquet("<file_name>.parquet.gz", compression="gzip", index=False)`
- load from parquet: `df = read_parquet("<file_name>.parquet.gz")`

## Load and Save with Pickle

- save to parquet: `df.to_pickle("<file_name>.pkl.xz", compression="xz")`
- load from parquet: `df = read_pickle("<file_name>.pkl.xz")`
- see <https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.to_pickle.html>
- see <https://pandas.pydata.org/docs/reference/api/pandas.read_pickle.html>

## Display Data

- count values in column (without `NaN` values): `df["col_name"].value_counts()`
Expand Down

0 comments on commit d462177

Please sign in to comment.