Quantcast
Channel: GameDev.net
Viewing all articles
Browse latest Browse all 17625

[python] cannot drop rows in dataFrame

$
0
0

Hi!

I have two problems with my code that used to work fine, maybe python updated or something. I have a dataFrame called data and try to drop rows that has ‘plant name’ either as ‘0’ or is empty. This is the code that fails now:

    data = df.iloc[start_row-1:end_row-1, start_col-1:end_col]
    names = df.iloc[start_row-2:start_row-1, start_col-1:end_col].astype(str)
    names = names.values.tolist()
    data.columns = names
    data = data.reset_index(drop=True)
    
    data = data[data['plant name'].notnull()]
    data = data[data['plant name'] != '0']

It gives me this error for any of the last two rows

Exception: cannot …


Viewing all articles
Browse latest Browse all 17625

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>