Dec-27-2018, 02:43 PM
Dear friends I am a experienced business analyst having worked on excel ad-dons/rapid-miner / qlikview for a number of years , but new to python coding
i am having problems with the following code
-----------------------------------------------------------------------------------------------
i am getting aggregated output for the year 2009, however I need aggregated output for all years between years 1880 to 2010
Using python 2.7
i am having problems with the following code
-----------------------------------------------------------------------------------------------
import pandas as pd names1880 = pd.read_csv('C:/names/yob1880.txt', names=['name', 'sex', 'births']) group = names1880.groupby('sex').births.sum() pieces = [] years = range(1880,2010) for year in years: columns = ['name', 'sex', 'births'] path = 'C:/names/yob%d.txt' % year frame = pd.read_csv(path, names=columns) frame['year'] = year pieces.append(frame) print(pieces) names = pd.concat(pieces, ignore_index=False) total_births = names.pivot_table('births', index='year', columns='sex', aggfunc=sum) print (total_births)---------------------------------------------------------------------------------------------
i am getting aggregated output for the year 2009, however I need aggregated output for all years between years 1880 to 2010
Using python 2.7