Replies: 2 comments
-
Hi Ed, You can pass in named groups via the Python API by using the import pandas as pd
import altair as alt
import datapane as dp
# process the data and create an Altair plot
df = pd.read_csv('https://raw.githubusercontent.com/owid/covid-19-data/master/public/data/vaccinations/vaccinations.csv')
countries = df['location'].sample(3)
subset = df[df.location.isin(countries)]
base_plot = alt.Chart(subset).encode(x='date:T', color='location').mark_line(size=5, opacity=0.75).interactive()
# Upload the assets into a TextReport to edit online
dp.TextReport(
dp.Group(
dp.Plot(base_plot.encode(y='total_vaccinations_per_hundred')),
dp.Plot(base_plot.encode(y='daily_vaccinations_per_million')),
dp.Plot(base_plot.encode(y='people_vaccinated')),
columns=3,
name="My_group"
)
).upload(id='E7y0nl3') Running this code will generate an asset called "My_group", which when clicked will insert the following markdown:
Does that solve your issue? |
Beta Was this translation helpful? Give feedback.
0 replies
-
It does, I'm not sure this was available when I first tried it a few weeks ago but glad it is possible! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hey Datapane team,
I create and send standalone reports to clients on a weekly basis and find the process of grouping assets available to the report a bit tedious.
For example, if I have two plot assets
weekly_imps_cpm
andweekly_click_ctr
I'd have to type these into the block generated by datapane in the markdown report as shown below.I thought it might be easier if we were allowed to create named groups to pass as assets (with nested assets in them) we can inject into the report ourselves.
The areas of focus on my reports change weekly but are mostly pretty consistent. In the event that I need to make a change, I'd much rather already have the assets I may use available in the report's asset library rather than build them in the report. It gives me a little extra freedom to build different kinds reports at the writing stage because I'd be importing a broader library of components, grouped or otherwise, which I can use to really change the story we're trying to share very easily.
For additional context, I'm using the markdown reports instead of the standard reports because it's much easier to write conclusions and references into the report after the plots and data are viewable. Writing my conclusions and commentary as text assets in the regular report doesn't feel quite right for my purposes.
Beta Was this translation helpful? Give feedback.
All reactions