pyobsplot
pyobsplot copied to clipboard
Make shorthand definition possible
Hi,
In line with having a syntax as close as possible to javascript it would nice to be able to use the shorthand syntax as seen here.
import pandas as pd
from pyobsplot import Plot
df = pd.DataFrame({'Date': {0: '1880-01-01', 1: '1880-02-01'}, 'Anomaly': {0: -0.3, 1: -0.21}})
Plot.lineY(df, {"x": "Date", "y": "Anomaly"}).plot()
AttributeError Traceback (most recent call last)
Cell In[15], line 5
2 from pyobsplot import Plot
4 df = pd.DataFrame({'Date': {0: '1880-01-01', 1: '1880-02-01'}, 'Anomaly': {0: -0.3, 1: -0.21}})
----> 5 Plot.lineY(df, {"x": "Date", "y": "Anomaly"}).plot()
AttributeError: 'dict' object has no attribute 'plot'
Not sure how feasible this is and not a dealbreaker for me but thought it was worth noting in case it wasn't on the radar.
Many thanks,
Harry
I'm not sure I would be able to implement this given the way python Plot methods are automatically generated, but this is indeed a very valid suggestion.
I keep this open, thanks for the idea !
This shortcut syntax should now be available in the development version (I have yet to add it to the documentation). It was much easier to implement than I thought.
Thanks again for the suggestion (and your patience).
I'm closing the issue for now but don't hesitate to reopen it if you encounter any problem.