|
| 1 | +--- |
| 2 | +category: "london" |
| 3 | +title: "pandas visualisation vol.2" |
| 4 | +level: "All" |
| 5 | +time: "18:30" |
| 6 | +rsvp_link: https://www.meetup.com/Python-Sprints/events/262426168/ |
| 7 | +project: |
| 8 | +sponsor: ecom |
| 9 | +--- |
| 10 | + |
| 11 | +Let's continue working on visualisation in `pandas`. |
| 12 | + |
| 13 | +Plotting in `pandas` is very easy, mainly by using `Series.plot()` and `DataFrame.plot()` methods. |
| 14 | +There is a plotting subsystem in `pandas` based in `matplotlib` that implement different types of |
| 15 | +plots (e.g. lines, bars, boxplots, kde...). |
| 16 | + |
| 17 | +In the last months, several new projects have been create to address new use cases for visualising |
| 18 | +in `pandas`. For example, to generate interactive plots. Some of these projects are: |
| 19 | + |
| 20 | +- https://hvplot.pyviz.org |
| 21 | +- https://github.com/PatrikHlobil/Pandas-Bokeh |
| 22 | +- https://github.com/altair-viz/pdvega/ |
| 23 | + |
| 24 | +Those libraries have been monkey patching `pandas` to be able to plot easily, so plotting can be |
| 25 | +done by using `DataFrame.hvplot()`, `DataFrame.plot_bokeh()`... |
| 26 | + |
| 27 | +But a better design would be to decouple the existing plotting code in pandas into an extension |
| 28 | +registered with the `pandas` extension capabilities, and be able to select with an option with |
| 29 | +plotting backend the user wants to use. The resulting code would be: |
| 30 | + |
| 31 | +```python |
| 32 | +pandas.set_option('plotting.backend', 'hvplot') |
| 33 | +df.plot() |
| 34 | +``` |
| 35 | + |
| 36 | +With this architecture, there are several advantages: |
| 37 | + |
| 38 | +- Developing new plotting backends for pandas becomes much simpler |
| 39 | +- Plotting backends share a common API |
| 40 | +- Users of pandas don't need to learn a new syntax for each plugin |
| 41 | +- Migrating existing code becomes trivial, by just adding a single line of code setting the option for the backend |
| 42 | +- Internal pandas code becomes cleaner, with the plotting code fully decoupled from the rest |
| 43 | + |
| 44 | +Work on this is already going on, with a first PR that decoupled the current plotting code: |
| 45 | + |
| 46 | +https://github.com/pandas-dev/pandas/pull/26414 |
| 47 | + |
| 48 | +In this sprint we will continue the work, by working on different tasks: |
| 49 | +- Adding the option to select the backend |
| 50 | +- Defining and documenting the pandas plotting API |
| 51 | +- Porting existing libraries to the new plotting API |
| 52 | +- Document current pandas functionality |
| 53 | + |
| 54 | +We also can work on other pandas issues, for example: |
| 55 | +- pytest-azurepipelines: <https://github.com/pandas-dev/pandas/issues/26601> |
| 56 | +- Documentation warnings: <https://github.com/pandas-dev/pandas/issues/24173> / <https://github.com/pandas-dev/pandas/issues/24661> |
| 57 | +- PandasArray in API docs: <https://github.com/pandas-dev/pandas/issues/24507> |
| 58 | +- pyarrow failure: <https://github.com/pandas-dev/pandas/issues/26656> |
| 59 | +- Organise dependencies: <https://github.com/pandas-dev/pandas/issues/26659> |
| 60 | +- Remove isort dependency: <https://github.com/pandas-dev/pandas/issues/26661> |
| 61 | +- Feel free to propose yours |
| 62 | + |
| 63 | +As usual, we will give priority to join the sprint to the next people: |
| 64 | + |
| 65 | +- Experienced open source contributors |
| 66 | +- People from underrepresented minorities in our sprints |
| 67 | + |
| 68 | +Agenda |
| 69 | +------ |
| 70 | + |
| 71 | +- 6:30pm: Food and networking |
| 72 | +- 6:45pm: Presentation of the project and the sponsor |
| 73 | +- 7:00pm: Coding |
| 74 | + |
| 75 | + |
| 76 | +The day of the sprint |
| 77 | +--------------------- |
| 78 | + |
| 79 | +- Bring your own laptop if you can |
| 80 | +- Join the [Gitter channel](https://gitter.im/py-sprints/pandas-bokeh) of the sprint |
0 commit comments