Selecting and importing only certain columns from excel for importing

。_饼干妹妹 提交于 2020-01-10 03:22:07

问题


'I have an excel file which contains many columns with strings, but i want to import certain columns of this excel file containing 'NGUYEN'.

I want to generate a string from columns in my excel which had 'NGUYEN' in them.

import pandas as pd
data = pd.read_excel("my_excel.xlsx", parse_cols='NGUYEN' in col for cols in my_excel.xlsx, skiprows=[0])
data = data.to_string()
print(data)


SyntaxError: invalid syntax

my_excel.xlsx

Function output should be

data =  'NGUYEN VIETNAM HANOIR HAIR PANTS BIKES CYCLING ORANGE GIRL TABLE DARLYN NGUYEN OMG LOL'   

来源:https://stackoverflow.com/questions/46751996/selecting-and-importing-only-certain-columns-from-excel-for-importing

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!