Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified lectures/_static/lecture_specific/pandas/pandas_share_prices.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 5 additions & 3 deletions lectures/pandas.md
Original file line number Diff line number Diff line change
Expand Up @@ -673,11 +673,10 @@ ticker_list = {'INTC': 'Intel',
'TM': 'Toyota',
'AAPL': 'Apple',
'AMZN': 'Amazon',
'BA': 'Boeing',
'C': 'Citigroup',
'QCOM': 'Qualcomm',
'KO': 'Coca-Cola',
'GOOG': 'Google',
'PTR': 'PetroChina'}
'GOOG': 'Google'}
```

Here's the first part of the program
Expand All @@ -695,6 +694,9 @@ def read_data(ticker_list,
for tick in ticker_list:
stock = yf.Ticker(tick)
prices = stock.history(start=start, end=end)

# Change the index to date-only
prices.index = pd.to_datetime(prices.index.date)

closing_prices = prices['Close']
ticker[tick] = closing_prices
Expand Down