so this is homework project in which we have to open a file from excel and take the values the numbers in each line and do an operation to find a final value, however the values are all in one cell. I am struggling with just extracting each number after I append them to their respective lists. I was hoping for some guidance, thanks (code is below).
,2003,2004,2005,2006,2007,2008,2009
Income statement,,,,,,,
Total Revenue,4075.52,5294.25,6369.3,7786.94,9411.5,9774.6,10707.4
Operating Income,420.85,606.49,780.52,893.95,1053.94,562,1419.4
Net Income,265.36,388.88,494.37,564.26,672.64,390.8,945.6
Balance Sheet,,,,,,,
Total Assets,2778.53,3386.54,3513.69,4428.94,5343.88,5576.8,6385.9
Total Equity,2071.11,2470.21,2090.26,2228.51,2284.12,3045.7,3674.7
Total Liabilities,707.42,916.33,1423.43,2200.43,3059.76,2531.1,2711.2
Cash Flow,,,,,,,
Operating,616.12,862.92,922.91,1131.63,1331.22,1389,1704.9
Investing,-616.42,-753.89,-220.62,-841.04,-1201.95,-421.1,-789.5
Financing,30.76,-66.55,-673.83,-155.33,-171.89,-642.2,-346
Net Cash Change,33.73,45.59,28.76,138.8,-31.34,330,564.2
import matplotlib as plt
import string
import numpy
listfile = []
yearlist = []
totalrev = []
opincome = []
netincome = []
totalassets = []
totalequity = []
totallib = []
operating = []
investing = []
financing = []
netchange = []
filename = raw_input('Enter the name of the file:')
try:
fd = open(filename, "r")
except IOError:
print 'Bad file name, try again'
# filename = raw_input('Enter the name of the file:')
for line in fd:
line_str = line.strip()
line_str = line_str.split(',')
listfile.append(line_str)
yearlist.append(listfile[0])
totalrev.append(listfile[2])
opincome.append(listfile[3])
netincome.append(listfile[4])
totalassets.append(listfile[6])
totalequity.append(listfile[7])
totallib.append(listfile[8])
operating.append(listfile[10])
investing.append(listfile[11])
financing.append(listfile[12])
netchange.append(listfile[13])
#ROE = netincome/totalequity
#ROE = (netincome/sales)*(sales/totalassets)*(totalassests/averageequity)

New Topic/Question
Reply



MultiQuote





|