我有两个数据框d1和d3。当我比较d1 == d3时,它返回行x列True或False。因为,现在我转换为df以断言断言。如果所有都是真的,有一种简单的方法可以返回True,如果找到任何False,则返回False。我在py.test中使用断言相等,因此它将使用完整。
var force: CGFloat { get }
返回boolean
使用词典:
.any()
输出:
def test_test001():
if df1.shape==df2.shape :
assert df1.to_dict()==df2.to_dict()
else:
assert 0, "Row are mis-matching"
def test_test002():
assert df1.to_dict()==df3.to_dict()
使用DataFrame
================================== FAILURES ===================================
________________________________ test_test001 _________________________________
def test_test001():
if df1.shape==df2.shape :
assert df1.to_dict()==df2.to_dict()
else:
> assert 0, "Row are mis-matching"
E AssertionError: Row are mis-matching
E assert 0
untitled0.py:19: AssertionError
===================== 1 failed, 1 passed in 6.43 seconds ======================
输出:
def test_test001():
if df1.shape==df2.shape :
assert df1.to_dict()==df2.to_dict()
else:
assert 0, "Row are mis-matching"
def test_test002():
assert df1==df3