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]
4 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]4 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
C&A's potato chip filling process has a lower specification limit of 9.5 oz. and an upper specification limit of 10.5 oz. Th
Law Incorporation [45]

Answer:

Process capability index = (USL - LSL)/6Sigma = 1/6(0.3)= 0.56

Answer (a) 0.56

Explanation:

3 0
4 years ago
What is the short description for Determining Deflections by Using Discontinuity Functions ?
maksim [4K]

Answer? somey

Explanation:

soy sause

6 0
3 years ago
Why is concrete on its own not a good material to use
Inga [223]

Answer:

It has poor tensile strength despite having high compressive strength

Explanation:

Concrete exhibits high compressive strength when used. However, it has very low compressive strength. This is the reason why concrete is normally combined with steel to make a composite building material called reinforced concrete. The steel reinforces concrete hence increasing the tensile strength in RC buildings. The end composite is durable and fireproof. Generally, the main reason why concrete is not use on its own is due to its poor tensile strength.

7 0
3 years ago
Two heat exchangers are under consideration for purchase. A standard type of heat exchanger (code name HX1) has an initial insta
Leviafan [203]

Answer:

The lower capitalized cost is associated with HX1

Explanation:

The capitalized cost is basically the present cost. Therefore, for the Heat Exchanger HX1, the capitalized cost will be:

CC1 = First Cost

<u>CC1 = - $ 20,000</u>

Negative sign shows cash outflow.

Now, for Heat Exchanger HX2, we have:

CC2 = - $ 34,000 + ($ 4,000)(P/F, 6%, 10)

Now, we use the factor tables to calculate the present worth (P) of the salvage value, which is actually future worth, after 10 years at a compounded interest of 6% per year.

The factor table is provided in picture, with the value indicated.

CC2 = - $ 34,000 + ($ 4,000)(0.5584)

CC2 = - $ 34,000 + $ 2,233.6

<u>CC2 = - $ 31,766.4</u>

From the capitalized cost, taking look at the absolute values of both heat exchangers we can conclude that:

<u>The Heat Exchanger that will result in lower capitalized cost is HX1</u>

3 0
3 years ago
Block A has mass of mA = 58kg and rests on a flat surface. The coefficient of static friction between the block and the surface
lesantik [10]

Answer:

The greatest mass, that the weight C can have such that block A does not move is approximately 23.259 kg

Explanation:

The given parameters are;

The mass of the block A= 58 kg

The coefficient of static friction between the block and the surface, \mu _s = 0.300

The coefficient of static friction between the rope and the fixed peg, B \mu _B = 0.310

Let T represent the tension in the rope

Therefore, when the rope is static, T = The normal reaction at the peg, B, N_B

The angle of inclination of the rope holding the block A = arctan(3/4) ≈ 36.87°

The length of the rope = √(0.4² + 0.3²) = 0.5

∴ sin(θ) = 3/5 = 0.6

cos(θ) = 4/5 = 0.8

The vertical component of the tension in the rope = T × sin(θ) = 0.6·T

The horizontal component of the tension in the rope = T × cos(θ) = 0.8·T

The friction force = μ×(W - 0.6·T) = 0.300×(58×9.8 - 0.6·T) = 170.52 - 0.18·T

The block will start to move when we have;

The horizontal component of the tension in the rope = The friction force

∴ 0.8·T = 170.52 - 0.18·T

0.8·T + 0.18·T = 170.52

0.98·T = 170.52

T = 170.52/0.98 = 174

Therefore, the tension in the rope = T = 174 N = The normal reaction at the peg, B N_B

The frictional force at the peg, F_B = \mu _B × N_B = 0.310 × 174 N = 53.94 N

The weight of the mass, m_c, W_c = The frictional force at the peg, F_B  + The tension in the rope

∴ The weight of the mass, m_c, W_c = 53.94 N + 174 N = 227.94 N

Weight, W = Mass, m × The acceleration due to gravity, g, from which we have;

m = W/g

Where;

g = 9.8 m/s²

∴ m_c = W_c/g = 227.94 N/(9.8 m/s²) ≈ 23.259 kg.

The greatest mass, that the weight C can have such that block A does not move = m_c ≈ 23.259 kg.

4 0
3 years ago
Other questions:
  • Express the Internal Energy and Entropy as a Function of T and V for a homogeneous fluid. Develop the same relations using the i
    6·1 answer
  • Danny is looking at deploying a new application that requires root-level access to the server. He is currently researching the c
    13·1 answer
  • REVIEW QUESTIONS
    11·1 answer
  • I need answers for this sheet please.
    15·1 answer
  • Saturated liquid water at 150 F is put under pressure to decrease the volume by 1% while keeping the temperature constant. To wh
    8·1 answer
  • If a motorist moves with a speed of 30 km/hr, and covers the distance from place A to place B
    13·1 answer
  • A developer has requested permission to build a large retail store at a location adjacent to the intersection of an undivided fo
    5·1 answer
  • Which of the following are the main psychological domains?
    7·1 answer
  • A series circuit has 4 identical lamps. The potential difference of the energy source is 60V. The total resistance of the lamps
    15·1 answer
  • PLEASE HELP, THANK YOU
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!