pandas数字读取和填充

import pandas as pd
from datetime import date,timedelta

books = pd.read_excel("C:/Users/asus/Downloads/Books.xlsx", skiprows=3, usecols="C:F",index_col=None, dtype={
     "ID":str,"InStore":str,"Date":str})
# books["ID"].at[0] = 100
# print(books["ID"])
start = date(2018,1,1)
for i in books.index:
    books["ID"].at[i] = i+1
    books["InStore"].at[i] = "Yes" if i % 2 == 0 else "No"
    books["Date"].at[i] = start + timedelta(days=i)


print(books)

你可能感兴趣的:(pandas数据分析)