Skip to content

Commit 1736c36

Browse files
committed
2.26
1 parent 881b0bb commit 1736c36

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

Work/dowstocks.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import csv
2+
3+
def date_tuple(s):
4+
return tuple(str(s).split('/'))
5+
6+
def main():
7+
with open('Data/dowstocks.csv') as f:
8+
rows = csv.reader(f)
9+
headers = next(rows)
10+
print(headers)
11+
types = [str, float, date_tuple, str, float, float, float, float, int]
12+
dow_stocks = [
13+
{ key: func(val) for key, func, val in zip(headers, types, row) }
14+
for row in rows
15+
]
16+
print(dow_stocks[0]['date'])
17+
print(len(dow_stocks))
18+
19+
if __name__ == '__main__':
20+
main()

0 commit comments

Comments
 (0)