i want convert column float , round values in column 2 decimal places. have:
df = pd.read_csv("test_data2.csv", converters={"col1":float64})
how round col1 2 decimal places?
if want convert float , round during reading csv
, can provide own conversion function. can it...
as lambda
:
df = pd.read_csv("test_data2.csv", converters={ "col1": lambda x: round(np.float64(x), 2)})
as function:
def round_float(digits): def f(x): return round(np.float64(x), digits) return f df = pd.read_csv("test_data2.csv", converters={"col1": round_float(2)})
Comments
Post a Comment