MCPcopy Create free account
hub / github.com/dabeaz-course/practical-python / read_prices

Function read_prices

Solutions/3_18/report.py:13–18  ·  view source on GitHub ↗

Read a CSV file of price data into a dict mapping names to prices.

(filename)

Source from the content-addressed store, hash-verified

11 return fileparse.parse_csv(lines, select=['name','shares','price'], types=[str,int,float])
12
13def read_prices(filename):
14 '''
15 Read a CSV file of price data into a dict mapping names to prices.
16 '''
17 with open(filename) as lines:
18 return dict(fileparse.parse_csv(lines, types=[str,float], has_headers=False))
19
20def make_report_data(portfolio,prices):
21 '''

Callers 1

portfolio_reportFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected