arrays - List stock data by weeks and days using Python -
I want to list various stock data published in a week. Stock data should be in all different array Different array elements should represent different days and arrays should be themselves for different weeks. So for example week_1 [55.5, 23.1234.8, 23.6]
. I have tried so far which code can be seen below, but unfortunately it just does not work. I always get an error: 'str' does not support item item assignment
. Any simple idea how can I fix this?
Python Code:
import datetime # open csv file lines = open ("google CSV") line = lines. Reid () line = lines. Split ("\ n") i = 0 while i
CSV File:
2011-02-07,610.16,618.39, 60 9.21,614.29,179 9 6,6,6.24.29 2011-02-04,610.15,611.44,606.61,610.98,1550800,610.98 2011-02-03,609.48, 611.45,606.13,610.15,1495100,610.15 2011-02-02,611.00,614.34,607.53,612.00,1760700, 612.00 20ll-02-0l604k49,6l3k35,603kll,6llk04,2745300,6llk04 20ll-0l-3l,603k60,604k47,595k55,600k36 , 2804900,600.36 2011-01-28,619.07,620.36,59 9.76,600.99,4231100,600.99
< P> In the following code: - A dictionary is created, containing the key like
'week_1'
- Each value is also a word Use
- with
, repeat on the file's file, paras dates using standard library content Thus we meet Import
Comments
Post a Comment