python - Create a multiline graph using vincent from a Pandas DataFrame -
I found a problem similar to the following: but I could not find the solution.
I want to display a multipurpose graph with the number of discussions processed by users, on chat equipment, for each hour.
I got a dataframe with the format below. The left column represents the hour, and every other column has the number of users discussed for each hour:
user1 user2 ... ... ... 0 0 9 1 0 10 0 0 11 0 12 12 11 0 ... ... ... Note: I did not show all the DF but I got the lines from 0 to 23.
I tried the following code to create my graph:
graph = Vincent Line (df) article. I got the following error: To correct the array size, press the Xis_titles (x = 'hour', y = 'number of discussions') Article Is not broadcastable
What I really do is wrong, I tried to do something else I copied my index as a serial in my DF, gave me the following form :
user1 user2 hours ... ... ... 8 0 0 8 9 1 0 9 10 0 0 10 11 0 11 11 12 11 0 12 ... .... .. And I tried the following code:
Article (title = "User") graph = vincent.line (df, iter_idx = 'hour') graph.axis_titles (x = 'hour', y = 'number of discussions' / pre> here I have not received any error, but as I posted in the link, like David Smith, I found a graph without any line, and only in Ambixasa is 0. I guess its parameters for vincent. Line object Not right, but I do not know how to pass them. Do you have any There is a four problem?
I have the same problem, what I did was creating a dictionary database instead of.
user_d = {} In the list for the call (df.column): user_d [col] = list (df [col]) user_d ['index'] = df .exex.tolist ) Article = vincent.Line (user_d, iter_idx = 'hour') Article. Xis_titles (x = 'hours', y = 'number of discussions') Alphabet (title = "user") Hope this helps!
Comments
Post a Comment