我想在我的网站上创建一个iSoliday功能pd.数据帧,以datetime作为索引,基于包含一年中的假日的csv文件。由于对pandas没有什么经验,我可以通过比较两个数据帧的值来想到一种迭代方法 更具体地说:
for i in range(0,len(Holidays)-1):
for j in range(0,len(df)-1):
if (Holidays.loc[i,'month']==df.loc[j,'month'] and
Holidays.loc[i,'day']==df.loc[j,'day'] ):
df.loc[j,'Isholiday']=1
else:
df.loc[j,'Isholiday']=0
我的问题是,如何以避免所有加工时间的方式实现这一点?你知道吗
您可能需要使用^{} 来实现:
相关问题 更多 >
编程相关推荐