Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/346.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 使用熊猫过滤Excel列_Python_Excel_Pandas_Filter_Automation - Fatal编程技术网

Python 使用熊猫过滤Excel列

Python 使用熊猫过滤Excel列,python,excel,pandas,filter,automation,Python,Excel,Pandas,Filter,Automation,我有5列,但我只想要列A=覆盖的行 A列B列等。。。 覆盖xxxx 矩阵xxxx 正确筛选列A的正确语法是什么?以下内容将删除名称与“Override”不同的列 import pandas as pd #read in dataframe df = pd.read_excel(path_to_df) cols_name = df.columns.tolist() for col in cols_name: if df[col] is not df['Override']:

我有5列,但我只想要列A=覆盖的行

A列B列等。。。 覆盖xxxx 矩阵xxxx


正确筛选列A的正确语法是什么?

以下内容将删除名称与“Override”不同的列

import pandas as pd

#read in dataframe
df = pd.read_excel(path_to_df)

cols_name = df.columns.tolist()
for col in cols_name:
    if df[col] is not df['Override']:
        del df[col]


df[df['columa']=='Override']