Python 使用熊猫过滤Excel列
我有5列,但我只想要列A=覆盖的行 A列B列等。。。 覆盖xxxx 矩阵xxxxPython 使用熊猫过滤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']:
正确筛选列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']