def test_get_data_ibm(): f = get_data_stooq("IBM.UK") assert f.shape[0] > 0
def test_get_data_stooq_dax(): f = get_data_stooq("^DAX") assert f.shape[0] > 0
def test_stooq_googl(): f = get_data_stooq("GOOGL.US") assert f.shape[0] > 0
def test_stooq_sp500(): f = get_data_stooq("^SPX") assert f.shape[0] > 0
def test_stooq_clx19f(): f = get_data_stooq("CLX19.F", start="20190101", end="20190115") assert f.shape[0] > 0
def test_get_data_stooq_dates(): f = get_data_stooq("SPY", start="20180101", end="20180115") assert f.shape[0] == 9
def test_get_data_stooq_dji(): f = get_data_stooq("AMZN") assert f.shape[0] > 0
def test_get_data_stooq_dji(): f = get_data_stooq('^DAX') assert f.shape[0] > 0
def test_get_data_stooq_dates(): f = get_data_stooq('SPY', start='20180101', end='20180115') assert f.shape[0] == 9
columns=['one', 'two']) df df.sum() df.sum(axis=1) # or axis='columns' df.mean(axis='columns', skipna=False) df.idxmax() # idxmax idxmin return index value where max r min is attained df.cumsum() df.describe() obj = pd.Series(['a', 'a', 'b', 'c'] * 4) obj.describe() df.count() # number of nonNA values df.quantile(0.5) Series(np.random.randn(10)).pct_change() import pandas_datareader.data as web all_data = {ticker: web.get_data_stooq(ticker) for ticker in ['AAPL', 'IBM', 'MSFT', 'GOOG']} price = DataFrame({ticker: data['Adj Close'] for ticker,data in all_data.items()}) volume = DataFrame({ticker: data['Volume'] for ticker,data in all_data.items}) returns = price.pct_change() returns.tail() returns.MSFT.corr(returns.IBM) returns.corr() returns.cov() returns.corrwith(returns.IBM) returns.corrwith(volume) obj = pd.Series(['c', 'a', 'd', 'a', 'a', 'b', 'b', 'c', 'c']) uniques = obj.unique() uniques obj.value_counts() pd.value_counts(obj.values, sort=False)