Python Forum
how to use dataframe in dash?
Thread Rating:
  • 1 Vote(s) - 3 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how to use dataframe in dash?
#2
data = pd.DataFrame({'x': [1,2,3], 'y1': [4,1,5], 'y2': [2, 4, 5]})
xvals = data.x.values.tolist()
names = ['SF', 'Montreal']
data_pars = [{'x': xvals, 'y': data[colname].values.tolist(), 'name': name, 'type': 'line'} for colname, name in zip(data.iloc[:, 1:].columns, names)]

dcc.Graph(
        id='example-graph',
        figure={
            'data': data_pars,
            'layout': {
                'title': ' Campaign Contacts '
            }
        }
    )    
Reply


Messages In This Thread
how to use dataframe in dash? - by zhujp98 - Jun-19-2018, 12:51 PM
RE: how to use dataframe in dash? - by scidam - Jun-20-2018, 12:19 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  create loop of subplot plotly dash without hardcode tonycat 0 3,903 Sep-23-2020, 08:40 AM
Last Post: tonycat
  How to update component props every time when a Dash callback returns? sguzunov 0 2,525 Jul-27-2020, 07:11 AM
Last Post: sguzunov
  Invalid archive error when attempting to install dash bootstrap components meaydemi 0 4,767 Jul-11-2019, 05:49 PM
Last Post: meaydemi
  dash problems zhujp98 0 2,239 Jun-14-2018, 03:30 PM
Last Post: zhujp98
  can not change double to single dash oco 7 4,618 Jun-03-2018, 09:51 AM
Last Post: wavic

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020