相关疑难解决方法(0)

如何按列方式剪辑pandas dataframe?

我有

In [67]: a
Out[67]:

   0  1  2
0  1  2  3
1  4  5  6
Run Code Online (Sandbox Code Playgroud)

我跑的时候

In [69]: a.clip(lower=[1.5,2.5,3.5],axis=1)
Run Code Online (Sandbox Code Playgroud)

我有

ValueError: other must be the same shape as self when an ndarray
Run Code Online (Sandbox Code Playgroud)

这是预期的吗?我期待得到类似的东西:

Out[72]:

     0    1    2
0  1.5  2.5  3.5
1  4.0  5.0  6.0
Run Code Online (Sandbox Code Playgroud)

python pandas

7
推荐指数
1
解决办法
3776
查看次数

标签 统计

pandas ×1

python ×1