You are on page 1of 1

Data Frame

import pandas as pd
AAPL = pd.read-csv(lokasi repository, index-col=0, parse_dates=True)
type(AAPL)
AAPL.shape
AAPL.columns
type(AAPL.columns)
AAPL.index
type(AAPL.index)

AAPL['Close']
type(AAPL['Close'])
AAPL[['Open','Close']]
type(AAPL[['Open','Close']])

Penggunaan iloc ==> integer location


AAPL.iloc[0]
AAPL.iloc[0:3]
AAPL.iloc[0:2,2]
AAPL.iloc[0:2,2:4]

Penggunaan loc ==> location


AAPL.loc['2007-10-10']
AAPL.loc['2007-10-10':'2007-10-17']
AAPL.loc['2007-10-10','Close':'Adj Close']

Filtering
lima_terakhir=AAPL.iloc[-5:]
lima_terakhir
diatas_seratus=lima_terakhir['Adj Close']>100
lima_terakhir[diatas_seratus]

Head() // Ngaran judulna Head


AAPL.head() //Awal Data
AAPL.tail() //Akhir Data
AAPL.info() //Info

Series // Ngaran Jududlna Series


high = AAPL['High']
type(high)
high.head()
high.tail()

plotting series
import matplotlib.pyplot as plt
close = AAPL['Close']
plt.plot(close)
plt.style.use('fivethirtyeight')
plt.plot(close)
plt.style.use('seaborn')
plt.plot(close)
AAPL['Close'].plot()
plt.plot(AAPL)
AAPL.plot()
AAPL.plot()
plt.yscale('log')

You might also like