熊猫轴的不一致性= 0/1 kwarg

时间:2019-04-25 15:05:16

标签: python pandas dataframe

请解决以下情况:

df.apply(foo, axis=0)
# ==> apply foo() to each column

df.mean(axis=0)
# ==> apply mean() to each column

pd.concat([df1, df2], ... axis=0)
# ==> concat df1's rows on top of df2's rows

df.dropna(... axis=0)
# ==> drop a row

def foo(row):
    return row.columnA + row.columnB
df.apply(foo, axis=1)
# ==> apply foo() to a row and move downwards to the next row. so, is this 
#     row-wise or column-wise? is this along a row or along a column?

并提出一个简单易行且统一的规则,以决定对axis使用1还是0。您将要链接的“重复帖子”仅说明了一部分,而不是全部。

0 个答案:

没有答案