Best Answer · By JanBask Data Science Expert
Answered on Nov 30, 2019
For removing unnamed columns, we need to import the dataset and after importing following libraries
import numpy as np
import pandas as pd
df=pd.read_csv('dfairannual.csv')
After importing the dataset, we get an unnamed column as follows:

Now to remove such a column that contains no name, we can try the following code.
df = df.loc[:~df.columns.str.contains('^Unnamed')]
Here, with this code, any columns which contain no names will be successfully removed.