Jays-code-collection / HMMs_Stock_Market

Contains all code related to using HMMs to predict stock market prices.
GNU General Public License v2.0
247 stars 59 forks source link

Using "f-Strings" #6

Closed artifexor closed 3 years ago

artifexor commented 3 years ago

Depend on which python version you are using you can use f-strings.

https://realpython.com/python-f-strings/#f-strings-a-new-and-improved-way-to-format-strings-in-python

You can use save_dir = f"{out_dir}/{stock_name}_results_plot.png" instead of this save_dir = out_dir + '/' + str(stock_name) + 'results_plot' + '.png'

or out_name = f"{out_dir}/{company_name}_HMM_Prediction_{round(mse, 6)}.csv" instead of out_name = out_dir + '/' + str(company_name) + '_HMM_Prediction_' + str(round(mse, 6)) + '.csv'

Simply looks cleaner.