[MDBF-86] Implement MariaDB specific %magic commands Created: 2020-05-25  Updated: 2022-02-01  Due: 2020-06-17

Status: Closed
Project: MariaDB Foundation Development
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Task Priority: Major
Reporter: Kaj Arnö Assignee: Robert Bindar
Resolution: Unresolved Votes: 0
Labels: jupyter
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
PartOf
is part of MDBF-55 Development of Jupyter maria kernel, ... Closed

 Description   

implement MariaDB specific %magic commands

  • eg. %bar %pie %line %df
    -(later: %stackedbar and %graph, which heuristically picks between bar/pie/line),
    thereby integrating with matplotlib by displaying the results of the last SELECT statement as a graph
  • show the syntax of the matplotlib commands (and any heuristics interesting to the user, so the user can adjust the select, or request better heuristics from us)


 Comments   
Comment by Robert Bindar [ 2020-11-04 ]

I implemented %bar %pie %line %df and %lsmagic.

All the charting magic commands are using under the hood the corresponding function from within pandas.DataFrame.plot.
Each charting magic has the ability to receive as arguments any option that would be valid in the corresponding function from DataFrame.plot and additionally any other option valid in DataFrame.plot or matplotlib's pyplot.plot. It just forwards the space-separated shell-like list of arguments to the right plot function of DataFrame.plot (e.g. %line x='col1' y='col2' subplots=True translates somewhere down the line into DataFrame.plot.line(x='col1', y='col2', subplots=True) )

The only exception to this mapping is in the %pie magic command. %pie accepts an optional index='column_name' which basically specifies the 'x' axis of the pie chart (the names of the slices). In Python it is possible to alter the index of a DataFrame with .set_index() before calling .plot.pie(), I thought it is a good idea to provide our users to do the same with this magic command.

Generated at Thu Feb 08 03:35:21 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.