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
A fluid flows steadily through a pipe with a uniform cross sectional area. The density of the fluid decreases to half its initia
Vikentia [17]

Answer:

c. V2 equals V1

Explanation:

We can answer this question by using the continuity equation, which states that:

A_1 v_1 = A_2 v_2 (1)

where

A1 is the cross-sectional area in the first section of the pipe

A2 is the cross-sectional area in the second section of the pipe

v1 is the velocity of the fluid in the first section of the pipe

v2 is the velocity of the fluid in the second section of the pipe

In this problem, we are told that the pipe has a uniform cross sectional area, so:

A1 = A2

As a consequence, according to eq.(1), this means that

v1 = v2

so, the velocity of the fluid in the pipe does not change.

5 0
3 years ago
In the situation shown below, what would the Moon look like from Earth? Sun, Earth and Moon Four Moon Views A. View A B. View B
Blababa [14]

Answer:

where is the picture?

Explanation:

3 0
3 years ago
A manufacturer makes two types of drinking straws: one with a square cross-sectional shape, and the other type the typical round
Harlamova29_29 [7]

Answer:

\frac{Q_{square}}{Q_{circle}} =  0.785  

Explanation:

given data

types of drinking straws

  1. square cross-sectional shape
  2. round shape

solution

we know that both perimeter of the cross section are equal

so we can say that

perimeter of square  = perimeter of circle  

4 × S = π × D

here S is length and D is diameter

S = \frac{\pi D}{4}        ....................1

and

ratio of  flow rate through the square and circle is here

\frac{Q_{square}}{Q_{circle}} = \frac{AV^2}{AV^2}  

\frac{Q_{square}}{Q_{circle}} = \frac{S^2}{\frac{\pi D^2}{4}}  

\frac{Q_{square}}{Q_{circle}} = \frac{(\frac{\pi D}{4})^2}{\frac{\pi D^2}{4}}  

\frac{Q_{square}}{Q_{circle}} = \frac{\pi }{4}  

\frac{Q_{square}}{Q_{circle}} =  0.785  

4 0
4 years ago
What is the shape of the output signal on a rigexpert analyzer?
Gekata [30.6K]

Answer:

Output signal shape: square, from 0.1 to 230 MHz. Output power: -10 dBm (at a load of 50 Ohms).

Explanation:

8 0
2 years ago
Read 2 more answers
What is an example of a class 2 lever?
9966 [12]

Answer:

A wheelbarrow, a bottle opener, and an oar are examples of second class levers

6 0
3 years ago
Read 2 more answers
Other questions:
  • What will happen in a wire drawing operation when the cross-sectional area has a reduction of 60% in a single pass?
    10·1 answer
  • Determine displacement (in) of a 1.37 in diameter steel bar, which is 50 ft long under a force of 27,865 lb if elasticity modulu
    5·1 answer
  • Sketch the velocity profile for laminar and turbulent flow.
    15·1 answer
  • 1. The area of the given triangle is 25 square units. What is the value of x?<br> X+2
    8·1 answer
  • Given a program with execution times broken down shown below. Assume that techniques can only be applied to accelerate the integ
    12·1 answer
  • What was the most important thing you learned this school year in your engineering class and why did you choose this thing
    15·1 answer
  • Set the leak rate to zero and choose a non-zero value for the proportional feedback gain.Restart the simulation and turn on the
    5·1 answer
  • Match the scenario to the problem-solving step it represents.
    7·1 answer
  • A 9 -slug mass hangs by a rope from the ceiling. Using the standard value of gravitational acceleration g = 32.2 fts 2, what is
    12·1 answer
  • Which of the given strategies is specifically a competitive advantage sustainment strategy?
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!