Reputation: 470
I have the following dataframe:
date high low Sentiment
0 2018-02-01 10288.80 8812.28 -4
1 2018-02-02 9142.28 7796.49 -1
2 2018-02-03 9430.75 8251.63 -2
3 2018-02-04 9334.87 8031.22 7
4 2018-02-05 8364.84 6756.68 -4
5 2018-02-06 7850.70 6048.26 -12
6 2018-02-07 8509.11 7236.79 -11
7 2018-02-08 8558.77 7637.86 -17
8 2018-02-09 8736.98 7884.71 9
9 2018-02-10 9122.55 8295.47 -4
10 2018-02-11 8616.13 7931.10 4
11 2018-02-12 8985.92 8141.43 0
12 2018-02-13 8958.47 8455.41 -3
13 2018-02-14 9518.54 8599.92 -4
My final goal is to represent all the values from the dataframe but I can't see the dates on the x-axis. I used this code:
df = Original_df [['date', 'high', 'low', 'Sentiment']].copy()
ax = df.plot(secondary_y='Sentiment')
ax.set_yscale('linear')
plt.show()
update: even in this way I don't see the dates. What am I doing wrong?
df = Original_df[['date', 'high', 'low', 'Sentiment']].copy()
df = df.set_index('date')
ax = df.plot(secondary_y='Sentiment')
ax.set_yscale('linear')
plt.show()
Upvotes: 1
Views: 2575
Reputation: 3290
This should do the trick:
df = df.set_index('date')
ax = df.plot(secondary_y='Sentiment')
Upvotes: 1