Ask Your Question
1

The mplfinance plot displays accurately, but the datetime format is unusual.

asked 2022-07-16 11:00:00 +0000

lalupa gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2021-12-24 14:00:00 +0000

woof gravatar image

To modify the datetime format in mplfinance, you can use the date_format parameter in the plot method.

For example, to display the date in the format "Month Day, Year", you can use the following code:

import pandas as pd
import mplfinance as mpf

# load data
data = pd.read_csv('data.csv', index_col='Date', parse_dates=True)

# create plot
mpf.plot(data, type='candle', mav=(10,20), volume=True, show_nontrading=True, date_format='%b %d, %Y')

In this example, the date_format parameter is set to '%b %d, %Y', which specifies the date format as "Month Day, Year". You can modify this parameter to display the datetime in any other desired format.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2022-07-16 11:00:00 +0000

Seen: 14 times

Last updated: Dec 24 '21