Quantcast
Viewing all articles
Browse latest Browse all 14360

Formatting a Numbers in DataFrame

Can someone please help me to format just numbers in a data frame to "int" and "comma"? I tried doing the same and got an error message mentioned below.

Error: int() argument must be string, a bytes-like object or a number, not 'DataFrame'

import pandas as pddata1 = {'Header':['L1','L2','L3'], 'Val1':[float(1000.2),float(2000.40),float(300.55)],'Val2':[float(4000.3),float(500.00),float(60000.55)]}

The expected output is mentioned below.

HeaderVal1Val2
L11,0004,000
L22,000500
L330160,001

Viewing all articles
Browse latest Browse all 14360

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>