Pandas format column as currency
def format(x):
return "${:.1f}K".format(x/1000)
df = pd.DataFrame(
{'A':['A','B','C','D'],
'C':[12355.00,12555.67,640.00,7000]
})
df['C'] = df['C'].apply(format)
print(df)
Or you could use a lambda function for shorter syntax
df['C'] = df['C'].apply(lambda x: "${:.1f}k".format((x/1000)))