EDIT : Sorry, I got confused rows with Columns,(noob here)
I have a CSV , where there are 3 columns,
heading, image and description.
Some of the items in description is Empty , and I want to delete the complete column if description is empty or has
length < 1
Firstly, I got all columns which has length of
description < 1using this Code :
for i in df['description']:
if len(i) < 1 :
print('Empty')
Output :
Empty
Empty
This means there are 2 columns which has description of length < 1 , Now i try to remove them :
for i in df['description']:
if len(i) < 1 :
df.drop(i, inplace=True, axis=1)
But, still there are those 2 columns with Empty data, how to remove them, What is wrong in my code ? Please Guide
also tried :
df = df.drop(df.columns[[i]], axis=1)
but, nothing works