python - Change specific value with dot in column -
i have following dataframe :
example 189 900 1.8 349 233
the problem 1.8 should considered 1800. how can change whole column? :
if cell in column contains value dot . value*1000
assuming data numeric, numeric values decimal part can caught i - np.floor(i) > 0
.
import pandas pd import numpy np # data # ================================ df = pd.read_clipboard() df example 0 189.0 1 900.0 2 1.8 3 349.0 4 233.0 # processing # =============================== df.example = np.where(df.example - np.floor(df.example) > 0, df.example*1000, df.example) df example 0 189 1 900 2 1800 3 349 4 233
Comments
Post a Comment