首页 > 其他分享 >pandas.DataFrame.shape-返回表示DataFrame维度的元组

pandas.DataFrame.shape-返回表示DataFrame维度的元组

时间:2023-03-16 17:58:56浏览次数:43  
标签:positive df1 negative DataFrame 元组 shape print

import pandas as pd

d1 = [[3,"negative",2],[4,"negative",6],[11,"positive",0],[12,"positive",2]]
df1 = pd.DataFrame(d1, columns=["xuhao","result","value"])
print(df1)

print(df1.shape)
print(df1.shape[0])

输出结果

xuhao    result  value
0      3  negative      2
1      4  negative      6
2     11  positive      0
3     12  positive      2
(4, 3)
4

 

标签:positive,df1,negative,DataFrame,元组,shape,print
From: https://www.cnblogs.com/chaimy/p/17222273.html

相关文章