Skip to content

Commit

Permalink
add pandas bug note
Browse files Browse the repository at this point in the history
  • Loading branch information
chennesy committed Oct 4, 2024
1 parent ec036ef commit 61b5831
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions episodes/data-visualisation.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ df_long.head()

Ok! We are now ready to plot our data. Since this data is monthly data, we can plot the circulation data over time.

::::::::::::::::::::::::::::::::::::: instructor
## Instructor note: Pandas 2.2.* bug
There is a bug in the latest release of Pandas that is causing certain plots to display in a garbled manner. This is a [known issue](https://github.com/pandas-dev/pandas/issues/59960) that the Pandas team plans to address. In the meantime, learners and instructors can user older versions of pandas *or* add `.sort_index()` before any instance of `.plot()`. For example, use `albany['circulation'].sort_index().plot()` instead of `albany['circulation'].plot()`.
:::::::::::::::::::::::::::::::::::::::::::::::::

At first, let’s focus on a specific branch. We can select the rows for the Albany Park branch:

``` python
Expand All @@ -66,6 +71,7 @@ albany.head()
| 2014-01-01 | Albany Park | 5150 N. Kimball Ave. | Chicago | 60625.0 | 50484 | 2014 | january | 35 |
| 2015-01-01 | Albany Park | NaN | NaN | NaN | 133366 | 2015 | january | 10889 |


Now we can use the `plot()` function that is built in to pandas. Let’s try it:

``` python
Expand Down

0 comments on commit 61b5831

Please sign in to comment.