0

This is the .head() of my DataFrame:

                 Open    High    Low     Close    Volume     Market Cap
Date                        
Apr 09, 2018    7044.32 7178.11 6661.99 6770.73 4894060000  119516000000
Apr 08, 2018    6919.98 7111.56 6919.98 7023.52 3652500000  117392000000
Apr 07, 2018    6630.51 7050.54 6630.51 6911.09 3976610000  112467000000
Apr 06, 2018    6815.96 6857.49 6575.00 6636.32 3766810000  115601000000
Apr 05, 2018    6848.65 6933.82 6644.80 6811.47 5639320000  116142000000

& the statement to plot the 'Close' over the DateIndex:

plot = df['Close'].plot()

By default the x-axis is labeled with 'Date' but no DateValues are shown.How to adjust this?
The y-axis is not labeled but the CloseValues are shown with intervals i also want to adjust.

Found no solution :( Thx for help as always!

2 Answers 2

1

Make the index a DatetimeIndex:

df.index = pd.to_datetime(df.index)

df.Close.plot()

enter image description here

Sign up to request clarification or add additional context in comments.

Comments

0

piRSquared's answer is correct (as usual). You can also do this in one line using

matplotlib.pyplot.plot(pd.to_datetime(df.index), df.Close);

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.