mardi 12 juillet 2016

Using a for loop to assign 40 years of data to separate dataframes, then combining them to one data frame, then sort by year


I have 40 years of data so I was trying to assign each of them to a dataframe individually then store them all in a new dataframe, then sort them. Below is what i have so far

import pandas as pd
from pandas import DataFrame

year = 1976
count = 1

for i in range(0,40):

    df[count] = pd.read_excel('42003h'+str(year)+'.xlsx', sheet_name = 'Sheet1')

    count = count + 1
    year = 1976 + 1

I was given this error

Wrong number of items passed 12, placement implies 1

any help would be appreciated please?


Aucun commentaire:

Enregistrer un commentaire