Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/355.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 根据列中的条件在数据帧中删除行_Python_Pandas_Dataframe_Rows - Fatal编程技术网

Python 根据列中的条件在数据帧中删除行

Python 根据列中的条件在数据帧中删除行,python,pandas,dataframe,rows,Python,Pandas,Dataframe,Rows,我有一个如下所示的数据框架 class number 2015 0 0 0 ret Real Estate 1 0 ret

我有一个如下所示的数据框架

                                       class                 number  2015                                   0             0     0   
ret                                    Real Estate             1     0   
ret                                          empty             2     0   
ret                                         Equity             3     0   
ret                                 Participations             4     0   
ret                                          empty             5     0   
ret                                 Private Equity             6     0   
ret                                     Hedge Fund             7     0   
ret                                     High Yield             8     0   
ret              Loan, Multitranchen, FSB, FSS_FSB             9     0   
ret                                          empty            10     0   
ret                                   Loan GR, FSB            11     0   
ret                                          empty            12     0   
ret                                Corporate Bonds            13     0   
我想删除列“class”中的值为“empty”的所有行。以下代码仅返回带有NA值的数据帧

df[df[["class"]] != "empty"]
有人能帮我吗?

df[df[“class”]!=“empty”]
df[['class']]
返回数据帧。