Data Analytics with Python for beginner: Pandas (9/18)

Published: 18 November 2022
on channel: Edwin Mok
362
3

Notes for Module 9:
https://drive.google.com/file/d/1e5VA...

Files:
https://drive.google.com/file/d/1NVbY...
https://docs.google.com/spreadsheets/...

Solution:
1. Code
import pandas as pd
data = [['Jack',20,12],['Helen',8,11.5],['Catherine',15,14.2],['Rick',-3,13.7]]
info = ['Manager','Returns(%)','Standard Deviation(%)']
fund = ['Fund A','Fund B','Fund C','Fund D']
df = pd.DataFrame(data, index = fund, columns = info)

2. Code
from pandas_datareader import DataReader as pdr
from datetime import datetime as dt
start = dt(2018,1,1)
end = dt(2021,12,31)
fb = pdr("META","stooq",start,end)
amzn = pdr("AMZN","stooq",start,end)
aapl = pdr("AAPL","stooq",start,end)
nflx = pdr("NFLX","stooq",start,end)
goog = pdr("GOOG","stooq",start,end)
fb_return = fn['Close'].pct_change().iloc[1:]
amzn_return = amzn['Close'].pct_change().iloc[1:]
aapl_return = aapl['Close'].pct_change().iloc[1:]
nflx_return = nflx['Close'].pct_change().iloc[1:]
goog_return = goog['Close'].pct_change().iloc[1:]
fb_return.describe()
amzn_return.describe()
aapl_return.describe()
nflx_return.describe()
goog_return.describe()


On this page of the site you can watch the video online Data Analytics with Python for beginner: Pandas (9/18) with a duration of hours minute second in good quality, which was uploaded by the user Edwin Mok 18 November 2022, share the link with friends and acquaintances, this video has already been watched 362 times on youtube and it was liked by 3 viewers. Enjoy your viewing!