Links

Format number to string

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

Input

Import libraries

from naas_drivers import yahoofinance

Input parameters

ticker = "TSLA"
date_from = -100
date_to = 'today'

Model

Get dataframe from Yahoo Finance

df_yahoo = yahoofinance.get(ticker,
date_from=-5)
df_yahoo

Output

Format number nicely

Get more information in the doc here
df_yahoo['VALUE'] = df_yahoo['Close'].map("€ {:,.2f}".format).str.replace(",", " ")
df_yahoo