当我在熊猫中使用过滤器时,为什么会发生此错误:TypeError:'int'对象不可迭代

当我想删除一些满足特定条件的元素时,python抛出以下错误:

TypeError                                 Traceback (most recent call last)
<ipython-input-25-93addf38c9f9> in <module>()
  4 
  5 df pd.read_csv('data/C2A2_data/BinnedCsvs_d400/fb441e62df2d58994928907a91895ec62c2c42e6cd075c2700843b89.csv');
----> 6 df = filter(df,~('-02-29' in df['Date']))
  7 '''tmax = []; tmin = []
  8 for dates in df['Date']:

TypeError: 'int' object is not iterable

以下是代码:

import pandas as pd
import matplotlib.pyplot as plt


df = pd.read_csv('data/C2A2_data/BinnedCsvs_d400/fb441e62df2d58994928907a91895ec62c2c42e6cd075c2700843b89.csv');
df = filter(df,~('-02-29' in df['Date']))

我该怎么办?

评论