pandasでInfとnanをで埋める.

pandasでInfとnanを平均で埋める.

In [416]: b
Out[416]:
          a   c
0  1.000000   3
1  2.000000   4
2  3.000000 NaN
3       inf   5

In [415]: b.replace(np.inf,np.nan).fillna(b.replace(np.inf,np.nan).mean())
Out[415]:
a c
0 1 3
1 2 4
2 3 4
3 2 5