pwwang / datar

A Grammar of Data Manipulation in python

Home Page:https://pwwang.github.io/datar/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

how to set specified number of decimal places in across function

antonio-yu opened this issue · comments

Sometimes I wanna set all the float columns to 2 decimal places , 3.2154 --3.22
any params could be set in the round function?

In the examples of across, it seems to keep zero decimals places

iris >> mutate(across(where(is_double) & ~c(f.Petal_Length, f.Petal_Width), round))

Try:

iris >> mutate(across(where(is_double) & ~c(f.Petal_Length, f.Petal_Width), round, 2))

Try:

iris >> mutate(across(where(is_double) & ~c(f.Petal_Length, f.Petal_Width), round, 2))

perfect, thanks,