Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/329.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 如何根据pandas中列的条件删除行? 我试图删除列2中包含'CENTER'的行_Python_Pandas_Keyerror - Fatal编程技术网

Python 如何根据pandas中列的条件删除行? 我试图删除列2中包含'CENTER'的行

Python 如何根据pandas中列的条件删除行? 我试图删除列2中包含'CENTER'的行,python,pandas,keyerror,Python,Pandas,Keyerror,作品: BuildingNameContains\u center=dframe[dframe[2].str.contains('center')] 输出作品: buildingname包含\u中心 产生错误: dframe.drop(buildingname包含\u center,inplace=True) KeyError:“[01 2 3 4 5 6 7 8 9 10 11 12 14 15 16 18 19 20 21 22\n 24 25 26 27 28 29 30 32 33 34

作品:

BuildingNameContains\u center=dframe[dframe[2].str.contains('center')]

输出作品:

buildingname包含\u中心

产生错误:

dframe.drop(buildingname包含\u center,inplace=True)


KeyError:“[01 2 3 4 5 6 7 8 9 10 11 12 14 15 16 18 19 20 21 22\n 24 25 26 27 28 29 30 32 33 34 35 36 37 38 39 40 41]未在轴”
dframe = dframe.loc[~dframe[2].str.contains('CENTER'), :]