提问人:CiaranWelsh 提问时间:3/25/2016 最后编辑:Mike MüllerCiaranWelsh 更新时间:3/25/2016 访问量:22982
如何在 Python 中将 pandas DataFrame 与 None 进行比较?
How to compare pandas DataFrame against None in Python?
问:
如何将 pandas DataFrame 与 ?我有一个构造函数,它接受一个或一个,但从不同时接受。None
parameter_file
pandas_df
def __init__(self,copasi_file,row_to_insert=0,parameter_file=None,pandas_df=None):
self.copasi_file=copasi_file
self.parameter_file=parameter_file
self.pandas_df=pandas_df
但是,当我稍后尝试比较 against 时(即当实际包含 pandas 数据帧时):pandas_df
None
self.pandas_df
if self.pandas_df!=None:
print 'Do stuff'
我收到以下 TypeError:
File "C:\Anaconda1\lib\site-packages\pandas\core\internals.py", line 885, in eval
% repr(other))
TypeError: Could not compare [None] with block values
答:
评论