This works p_table.apply(pd.Series.round)
however it has no decimal places
Documentation says
import pandas as pd
Series.round(decimals=0, out=None)
i tried this p_table.apply(pd.Series.round(2))
but get this error:
unbound method round() must be called with Series instance as first argument (got int instance instead)
How do I round all elements in the data frame to two decimal places?
[EDIT] Figured it out.
import numpy as np
np.round(p_table, decimals=2)
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…