Python Pandas: DataFrame filter negative values

前端 未结 4 583
独厮守ぢ
独厮守ぢ 2021-01-31 05:30

I was wondering how I can remove all indexes that containing negative values inside their column. I am using Pandas DataFrames.

Documentation Pandas DataFr

4条回答
  •  孤城傲影
    2021-01-31 06:30

    You could loop over the column names

    for cols in data.columns.tolist()[1:]:
        data = data.ix[data[cols] > 0]
    

提交回复
热议问题