I need to delete the row if there is data missing in a certain column in the current row.
This is what I wrote:
for c, r in data.iterrows():
if (r['A'] == ""):
data = data.drop(r)
But I receive the error:
"unreadable key error"
I need to delete the row if there is data missing in a certain column in the current row.
This is what I wrote:
for c, r in data.iterrows():
if (r['A'] == ""):
data = data.drop(r)
But I receive the error:
"unreadable key error"
You can do something like this:
data = data.drop(data[data['A'] == ''].index)
OR
data[data['A'] != ""]
Try this, using boolean indexing:
data[data['A'] != ""]
data['A'] != ""
returns as bolean series that is True for each row where that value is not "".
For your part identation error if not you have to refer them as NaN values.
For dropping the data from a row if having null values. df = df[df['Column_name'].notna()]