1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Semmy [17]
3 years ago
14

Write a function named "read_prices" that takes one parameter that is a list of ticker symbols that your company owns in their p

ortfolio. You are to read a CSV file for each of these tickers which contains the price of each stock throughout the year and return these prices in a single dictionary. The returned dictionary will contain ticker symbols as keys and dictionaries as values where the inner dictionaries will have dates as keys (as strings in the format "YYYY-MM-DD") and prices as values as floats. All said this dictionary will contain the price for any stock on any date over the past year
Engineering
1 answer:
ohaa [14]3 years ago
7 0

Answer:

import pandas pd

def read_prices(tickers):

price_dict = {}

# Read ingthe ticker data for all the tickers

for ticker in tickers:

# Read data for one ticker using pandas.read_csv  

# We assume no column names in csv file

ticker_data = pd.read_csv("./" + ticker + ".csv", names=['date', 'price', 'volume'])

# ticker_data is now a panda data frame

# Creating dictionary

# for the ticker

price_dict[ticker] = {}

for i in range(len(ticker_data)):

# Use pandas.iloc  to access data

date = ticker_data.iloc[i]['date']

price = ticker_data.iloc[i]['price']

price_dict[ticker][date] = price

return price_dict  

You might be interested in
Which branch of engineering most closely relates to mechanical engineering?
Rus_ich [418]

Answer:

C

Explanation:

I COULD be wrong, i'm not sure but im confident its c

4 0
3 years ago
1. On a 2001 Honda Civic, while replacing fuel injectors, what do you coat the new O-rings with?
scoundrel [369]

Answer:

Coat new O-rings (D) with silicone oil or polyalkyleneglycol (PAG) oil, and pull them on the injectors.

3 0
3 years ago
Meaning of temporary stitches​
algol13

Answer:

They are use to hold garment or fabric pieces together before pernament stitches are made

6 0
2 years ago
Read 2 more answers
Which option shows the most valuable metallic properties
Rina8888 [55]

Malleable and ductile

non metals like plastic also have other properties but can't be malleable and ductile so they r most valuable metallic properties

6 0
2 years ago
Milk has a density of as much as 64.6 lb/ft3. What is the gage pressure at the bottom of the straw 6.1 inches deep in the milk?
gregori [183]

Answer:

Explanation:

1 inch is 0.0833333feet

6.1 inches is 0.5083 feet

Density = mass/volume

64.6 = mass/0.50833

mass = 64.6 x 0.5083 =32.83618lb

3 0
3 years ago
Other questions:
  • A piston-cylinder device contains an ideal gas mixture of 3 kmol of He gas and 7 kmol of Ar gas (both gases are monatomic) at 27
    15·2 answers
  • 3. (9 points) A square-thread power screw is used to raise or lower the basketball board in a gym, the weight of which is W = 10
    12·1 answer
  • How do you calculate the dynamic lift in an aeroplane?
    5·1 answer
  • How much heat (Btu) is prod uced by a 150-W light bulb that is on for 20-hours?
    14·1 answer
  • A mass weighing 22 lb stretches a spring 4.5 in. The mass is also attached to a damper with Y coefficient . Determine the value
    12·1 answer
  • A mass of air occupying a volume of 0.15m^3 at 3.5 bar and 150 °C is allowed [13] to expand isentropically to 1.05 bar. Its enth
    11·1 answer
  • An aggregate blend is composed of 65% coarse aggregate by weight (Sp. Cr. 2.635), 36% fine aggregate (Sp. Gr. 2.710), and 5% fil
    5·1 answer
  • Is an ideal way for a high school student to see what an engineer does on a typical day but does not provide a hands-on experien
    9·2 answers
  • Who was the American founder and leader of the Shakers in the 1770’s who advocated equality, individual responsibility, and peac
    11·2 answers
  • Design drawings use line styles of up to eight different varieties to communicate important information about the item. true or
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!