Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
62 views
in Technique[技术] by (71.8m points)

python - Pandas - Convert dataframe format


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Try this:

df = df.set_index('Date')

Or you could do inplace like:

df.set_index('Date', inplace=True)

Then:

print(df)

Would give:

            Open        High        Low         Close       Adj Close   Volume
Date                        
2020-01-22  167.399994  167.490005  165.679993  165.699997  163.963043  24138800

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...