Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试使用 df.iloc[] 来定位数据框中的特定单元格。但我们无法做到这一点,因为单元格包含时间戳格式的日期。我想我们需要将其转换为 int 或 string 或 float 类型。我们如何做到这一点?
这取决于该行应该回答的条件。如果您正在寻找特定日期范围,请尝试以下操作:
dates=pd.date_range(A,Z) day1DF= LWeekDF.ix[(LWeekDF['ReportTime']>=dates[A]) & (LWeekDF['ReportTime']<=dates[1])]
您现在有一个数据框,其中包含满足该条件的行。这也适用于其他条件。如果日期给你带来问题试试这个
A=pd.datetime.date(a)