def test_stocks_column_names():
    stocks = data.stocks()
    assert type(stocks) is pd.DataFrame
    assert sorted(stocks.columns) == ["date", "price", "symbol"]

    stocks = data.stocks.raw()
    assert type(stocks) is bytes
def test_stocks_column_names():
    stocks = data.stocks()
    assert type(stocks) is pd.DataFrame
    assert tuple(stocks.columns) == ('symbol', 'date', 'price')

    stocks = data.stocks.raw()
    assert type(stocks) is bytes
def test_stocks_column_names():
    stocks = data.stocks()
    assert type(stocks) is pd.DataFrame
    assert sorted(stocks.columns) == ['date', 'price', 'symbol']

    stocks = data.stocks.raw()
    assert type(stocks) is bytes
'''
Trellis Area Sort Chart
-----------------------
This example shows small multiples of an area chart.
Stock prices of four large companies
sorted by `['MSFT', 'AAPL', 'IBM', 'AMZN']`
'''
# category: area charts
import altair as alt
from vega_datasets import data

source = data.stocks()

alt.Chart(source).transform_filter(
    alt.datum.symbol != 'GOOG'
).mark_area().encode(
    x='date:T',
    y='price:Q',
    color='symbol:N',
    row=alt.Row('symbol:N', sort=['MSFT', 'AAPL', 'IBM', 'AMZN'])
).properties(height=50, width=400)
import altair as alt
from vega_datasets import data

stocks = data.stocks()

___ = alt.Chart(stocks).mark_line().encode(x='date', y='price', color='symbol')

___ + ___
Exemple #6
0
def test_download_stock_parsing():
    stocks = data.stocks(use_local=False)
    assert all(stocks.dtypes == ['object', 'datetime64[ns]', 'float64'])
Exemple #7
0
def test_stock_pivoted():
    stocks = data.stocks(pivoted=True)
    assert stocks.index.name == 'date'
    assert all(stocks.columns == ['AAPL', 'AMZN', 'GOOG', 'IBM', 'MSFT'])
Exemple #8
0
def test_stock_date_parsing():
    stocks = data.stocks()
    assert all(stocks.dtypes == ['object', 'datetime64[ns]', 'float64'])
Exemple #9
0
def test_download_stock_parsing():
    stocks = data.stocks(use_local=False)
    assert all(stocks.dtypes == ["object", "datetime64[ns]", "float64"])
Exemple #10
0
def test_stock_pivoted():
    stocks = data.stocks(pivoted=True)
    assert stocks.index.name == "date"
    assert sorted(stocks.columns) == ["AAPL", "AMZN", "GOOG", "IBM", "MSFT"]
Exemple #11
0
def test_stock_date_parsing():
    stocks = data.stocks()
    assert all(stocks.dtypes == ["object", "datetime64[ns]", "float64"])