I have a dataframe containing incalculable rows and columns. The df is structured in such that until 6th row and 2nd column, I have string as input and the rest are numbers(floating points). I want to discard the rows from the df whose sum is equal to zero, however, keeping the structure intact. I don't want to drop the first 6 rows and the 1st column as they hold crucial dataframe.
Original dataframe(df): original_df
Expected output: expected_df2
I tried this way but it didn't do the expected job. Instead the 6 rows and the 1st column have been removed removed.
df_filt = df.iloc[6:, 1:].astype(float)
rows_filt = df_filt.sum(axis=1) > 0
if rows_filt.any(): df = df.loc[rows_filt.index] else: print("No row sum equals zero.")