I have a dataset that looks like this.
Date Name High Value
2017-12-31 Bitcoin 14377.40 18723.76
2017-12-30 Bitcoin 14681.90 18766.88
2017-12-29 Bitcoin 15279.00 18755.70
2017-12-28 Bitcoin 15888.40 18820.54
... ... ... ...
2017-01-08 CannaCoin 0.01 0.02
2017-01-07 CannaCoin 0.01 0.02
2017-01-06 CannaCoin 0.01 0.02
2017-01-05 CannaCoin 0.02 0.01
Date is the index column and is in the datetime format. My dataset is big and has more than one item in the Name
column. The dates range from the beginning of the year till the end. Also, not all items are of the same length. Most should finish at the end of the year but they don't necessarily start in the beginning of it, they can start later.
What I would like to do is, group by Name
values, and for each create a separate line on the same graph/plot. Value
should be on the y axis.
Because I am used to R, what I did was:
df.groupby("Name")["Value"].plot()
What I got is a warning:
UserWarning: Attempting to set identical left==right results in singular transformations; automatically expanding. left=17531.0, right=17531.0 'left=%s, right=%s') % (left, right))
Also, the plot looked like this:
As observable, half of the values are missing, as they are outside the plotting area, dates are in a descending instead of an ascending order and half of the plot is empty.
How can I fix this, so that the entire plot will be visible, with the dates in a correct order?