I am Importing MS Excel File with below columns County, Country Name, Indicator, Indicator Name, 2000, 2001, 2002, 2003 to Dataframe
Data = Data = pd.read_excel('File Path')
Data.columns.str.upper() -- Will give NAN for Integer column names
Data.loc[:, ~Data.columns.str.contains('Name:')] -- TypeError: bad operand type for unary ~: 'Index'
Source File Location: http://databank.worldbank.org/data/download/India_PSR_excel.zip
How to change column name to string?
Use parameter na=False
:
Data.loc[:, ~Data.columns.str.contains('Name:', na=False)]