Skip to content

Commit

Permalink
Pandas 2.0 compat in docs
Browse files Browse the repository at this point in the history
  • Loading branch information
mwaskom committed Apr 3, 2023
1 parent 011caac commit 4f72554
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
5 changes: 4 additions & 1 deletion doc/_docstrings/relplot.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,10 @@
"metadata": {},
"outputs": [],
"source": [
"flights_wide = sns.load_dataset(\"flights\").pivot(\"year\", \"month\", \"passengers\")"
"flights_wide = (\n",
" sns.load_dataset(\"flights\")\n",
" .pivot(index=\"year\", columns=\"month\", values=\"passengers\")\n",
")"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion doc/_tutorial/data_structure.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@
"metadata": {},
"outputs": [],
"source": [
"flights_avg = flights.groupby(\"year\").mean()\n",
"flights_avg = flights.groupby(\"year\").mean(numeric_only=True)\n",
"sns.relplot(data=flights_avg, x=\"year\", y=\"passengers\", kind=\"line\")"
]
},
Expand Down
5 changes: 4 additions & 1 deletion examples/spreadsheet_heatmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@

# Load the example flights dataset and convert to long-form
flights_long = sns.load_dataset("flights")
flights = flights_long.pivot("month", "year", "passengers")
flights = (
flights_long
.pivot(index="month", columns="year", values="passengers")
)

# Draw a heatmap with the numeric values in each cell
f, ax = plt.subplots(figsize=(9, 6))
Expand Down

0 comments on commit 4f72554

Please sign in to comment.