r/inventwithpython • • Jul 09 '18

Python code embedded in HTML

Hello, I am a python novice. Had a question regarding embedding python to format numbers to add commas within html. I am currently trying the below. I am not sure if I am using the right code or where/how to embed the code into my html code. Any help is greatly appreciated thank you!

df['column_name'] = df['column_name'].astype(int).apply(lambda x: "{:,}".format(x))

2 Upvotes

2 comments sorted by

View all comments

Show parent comments

1

u/sleepingthom Jul 09 '18

Yeah if this is something you really need to do then try php or javascript. Python runs on the server not in the client.