Please be sure to submit your work to Canvas by submitting your. ipynb file. Start by creating a dictionary of stocks (called yourname_stocks) and their market caps (minimum number of stocks in the...

1 answer below »


Please be sure to submit your work to Canvas by submitting your. ipynb file.


Start by creating a dictionary of stocks (called yourname_stocks) and their market caps (minimum number of stocks in the dictionary is 10).






PART 1:



Please print() after each one of the following:



  • Please return the following using a dictionary in python:

    1. Add a new stock and its market cap to the dictionary

    2. Print (i.e. access) a market cap for one of your stocks

    3. Update the market cap of one of your stocks

    4. Delete one of your stocks (and its market cap)

    5. Use a for loop bring back all of the keys and values from your dictionary (be sure to capitalize each ticker by using the correct .method)

    6. Sort your dictionary (similar but different than sorting a list)



  • Create a while loop that calculates how long it will roughly take you to earn 10x your money

    1. Assume a rate of return of 8%

    2. Assume your starting balance is $10,000





Some hints for #2:



  • Start by figuring out the finance formula (if you knew all the inputs)

  • You will need to define a few variables (starting balance, rate of return, starting yrs)

  • Using a while loop, calculate the new balance after 1 yr

  • We learned about += (for yrs) but you can also use *= (for balance)

  • Print () the new balance at the end of each year




Class topics



  • Dictionaries

  • Accessing data from a dictionary

  • Adding to a dictionary

  • Changing Values in a dictionary

  • Creating an Empty dictionary

  • Looping through a dictionary

  • If, else in a Dictionary

  • While loops




PART 2:



Numpy:




  • Import numpy as np


  • Create a numpy array using 20 days’ worth of prices for 1 stock (please tell me your stock ticker using # in your code)


  • Please print the shape of your array


  • Using numpy, please print the sum, the mean and the standard deviation of your stock prices


  • What does the standard deviation tell us about your stock? Please write your answer in your Jupyter notebook using #


  • Import Seaborn as sns


  • Plot a distplot of your stocks prices. Does it follow a normal distribution?



Pandas:




  • Import pandas as pd


  • Convert your Numpy stock price array to a pandas data frame and name it df


  • Statistically describe the data in your df


  • Rename a column in your df


  • Calculate the daily percent change of your stock and add a column showing this daily percent change


  • Describe the new df



Functions:




  • Create a function that given a string it returns the number of vowels in the string



Datetime:



  • Import the datetime library

  • Calculate how many days you have spent at Ithaca College



Class topics:



  • Numpy

  • Pandas

  • Dataframes

  • Arrays

  • Functions

  • Datetime



Answered 1 days AfterApr 15, 2022

Answer To: Please be sure to submit your work to Canvas by submitting your. ipynb file. Start by creating a...

Suraj answered on Apr 16 2022
90 Votes
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here