\n","author":{"@type":"Person","name":"eeco_haldia"},"upvoteCount":0,"answerCount":1,"acceptedAnswer":{"@type":"Answer","text":"
If Unwanted rows have specific part string common then you could explicitly delete those using
\ndf_new = df[~df.columnName.str.contains("FINANCIAL SERVICES")]\n
\nand if the row cells are NULL use dropna
\ndf.dropna(subset=df.columns[1:], how= 'all', inplace = True)
Reputation: 45
I want to delete some specific rows in a Dataframe in Python . The dataframe consists of a series of tables and we have to delete the rows where only the first cell has values . For example the in the bottom , rows highlighted in yellows.
Upvotes: 0
Views: 243
Reputation: 501
If Unwanted rows have specific part string common then you could explicitly delete those using
df_new = df[~df.columnName.str.contains("FINANCIAL SERVICES")]
and if the row cells are NULL use dropna
df.dropna(subset=df.columns[1:], how= 'all', inplace = True)
Upvotes: 1