Format number to string
Tags: #pandas #dataframe #format #snippet #yahoofinance #naas_drivers
Author: Florent Ravenel
With this template, you can convert a series of number nicely using pandas.map

Input

Import libraries

1
from naas_drivers import yahoofinance
Copied!

Input parameters

1
ticker = "TSLA"
2
date_from = -100
3
date_to = 'today'
Copied!

Model

Get dataframe from Yahoo Finance

1
df_yahoo = yahoofinance.get(ticker,
2
date_from=-5)
3
df_yahoo
Copied!

Output

Format number nicely

Get more information in the doc here
1
df_yahoo['VALUE'] = df_yahoo['Close'].map("€ {:,.2f}".format).str.replace(",", " ")
2
df_yahoo
Copied!
1
Copied!
Copy link
Edit on GitHub