HomeОбразованиеRelated VideosMore From: sentdex

Intro and Getting Stock Price Data - Python Programming for Finance p.1

2859 ratings | 295410 views
Welcome to a Python for Finance tutorial series. In this series, we're going to run through the basics of importing financial (stock) data into Python using the Pandas framework. From here, we'll manipulate the data and attempt to come up with some sort of system for investing in companies, apply some machine learning, even some deep learning, and then learn how to back-test a strategy. I assume you know the fundamentals of Python. If you're not sure if that's you, click the fundamentals link, look at some of the topics in the series, and make a judgement call. If at any point you are stuck in this series or confused on a topic or concept, feel free to ask for help and I will do my best to help. https://pythonprogramming.net https://twitter.com/sentdex https://www.facebook.com/pythonprogramming.net/ https://plus.google.com/+sentdex
Html code for embedding videos on your blog
Text Comments (438)
sentdex (11 months ago)
Now that Google has also thwarted our efforts, here is a quick example of grabbing data with morningstar instead: import datetime import pandas_datareader.data as web start = datetime.datetime(2015, 1, 1) end = datetime.datetime.now() df = web.DataReader("TSLA", 'morningstar', start, end) df.reset_index(inplace=True) df.set_index("Date", inplace=True) df = df.drop("Symbol", axis=1) print(df.head())
Tiantian Chen (3 months ago)
Hi, yahoo, google and morningstar, all of these are not working. what API works for this example now?
Aram Hussein (4 months ago)
Morning is done for, use iex Many thanks for your great tutorials !
Olorato Mosiane (6 months ago)
'morningstar' is not working
Reza Niazi (6 months ago)
thanks man , you end my struggle to find a solution to make this code work
Jorge Rios (6 months ago)
I've also got this one is using Quandl import datetime as dt import matplotlib.pyplot as plt from matplotlib import style import pandas as pd pd.core.common.is_list_like = pd.api.types.is_list_like import pandas_datareader.data as web style.use('ggplot') start = dt.datetime(2000,1,1) end = dt.datetime(2016,12,31) df = web.DataReader('TSLA', 'quandl', start, end) print(df.tail(6))
SUMIT VERMA (5 days ago)
wow
Adam Moore (8 days ago)
thank you very much sentdex your tutorials change my life to the better.
Zhang Yang (11 days ago)
awesome stuff. :)
Manish Gupta (12 days ago)
Putting the source code on github always gets more views people some people are interested in tutorials which give code... they skip the ones where there is no code given.... but that is if you are looking to get more views and likes...
Manish Gupta (11 days ago)
No source, just personal observation.. on mannerisms perhaps it came out wrong, please let me rephrase it.. Your tutorials are very helpful... please share the link of the source code.. maybe in the show more section of the first video... that would be very helpful.. thanks...
sentdex (12 days ago)
Got a source to back that up or...? The source code is on my website. Not sure why the crabbyness.
Louie (22 days ago)
how can you grab data directly from stock market? do you need a license for that?
Ajay Kumar (25 days ago)
Hey, I want to do the algorithm and data structure course in python. And want to practice question of python. Please suggest me some source to practice question in python. If anyone knows they can reply but only for python practice.
Rajesh Panicker (22 days ago)
https://www.practicepython.org/
Rajesh Panicker (22 days ago)
https://www.w3resource.com/python-exercises/
joy sen (1 month ago)
Would you make a video on how to add two or more indicators
Coeurdelion (1 month ago)
You’re the man
Don Philip (1 month ago)
What if the site isn’t .com Say it’s .ca or .co.uk , how would I still have it linked
cod4Rlp (1 month ago)
why not use a bloody ide?
sentdex (1 month ago)
I am using an IDE, not sure why it needs to be bloody though.
Daniel Cabezas (1 month ago)
Which IDE is used in the video?
James Cole (1 month ago)
Don’t know how I took so long to find your channel but thank you! Along with Corey Schafer I’m learning so much faster!
Dark Shinigami (1 month ago)
I got " ModuleNotFoundError: No module named 'matplotlib' ", anyone can help?
Dark Shinigami (1 month ago)
+Lost nAustin I also use Mac and Python in Jupyter Notebook. What i did is simply copy the same code than the one in the video, but apparently I hadn't previously installed matplotlib
Lost nAustin (1 month ago)
It's hard to help without more info, but try------ "sudo easy_install-"Python_VersionNumber" pip..... eg. "sudo easy_install-3.7 pip" after install follow with pip install matplotlib. This is how I worked around the imports on MacOSx in Visual studio, without messing with MacPython, Python 3.7.2 instead
Jo Ro (2 months ago)
Bravo. Everything worked on the 1st time!
tiediealien (1 month ago)
+Jo Ro Thanks a ton for your reply, everything works like a charm now. I really appreciate it.
Jo Ro (1 month ago)
I had to comment out those lines tho...
Jo Ro (1 month ago)
+tiediealienThis worked- import datetime as dt import matplotlib.pyplot as plt from matplotlib import style import pandas as pd import pandas_datareader.data as web style.use('ggplot') start = dt.datetime(2017, 1, 1) end = dt.datetime.now() df = web.DataReader('CVX','yahoo', start, end) #df.reset_index(inplace=True) #df.set_index("Date", inplace=True) #df = df.drop("Symbol", axis=1) print(df.head()) # good default debug. Defaults to 5. Can put more in the () like 7 print(df.tail())
tiediealien (1 month ago)
Would you be able to walk me through how you got it working? Right now I cannot pull from robinhood, google, yahoo, or quandl
Mark SW (2 months ago)
so cool. thanks!
Derbi Calderon (2 months ago)
First, I want to say thank you to the community for your input and help. Second, If you're getting errors still, check out this link: https://stackoverflow.com/questions/47179433/python-2-7-functools-lru-cache-does-not-import-although-installed/52917452#52917452?newreg=b982e43c839c4a43811c23f8b12ae9b6 it helped me out with my errors. Specifically the uninstalling, auto-remove, and reinstalling comment .
Ryan Kirchberger (2 months ago)
How do you get to plain white page like that
Beto Rdz [MEXICANO] (2 months ago)
You make it very easy! Thx a lot!
Elbert M'KIZY (2 months ago)
did you save the TSLA file on your computer or does panda_datareader.data automatically gets it from yahoo.com?
giridhart (2 months ago)
Hi Is there a way to get fundamental data from somewhere?
Stephen Tan (2 months ago)
import datetime import pandas_datareader.data as web start = datetime.datetime(2015, 1, 1) end = datetime.datetime.now() df = web.DataReader("TSLA", 'robinhood', start, end) print(df.head())
Lamont Poteat (2 months ago)
Pandas.datareader is giving me a issue. Fix? I've tried all of the fixes in the comments to no avail. Am I missing something or data reader not working?
Mattpa (2 months ago)
Does this help? https://pypi.org/project/fix-yahoo-finance/
ivy lee (3 months ago)
Now that it is working, but why is it only 5 days of data?
ivy lee (3 months ago)
ImmediateDeprecationError: Morningstar has been immediately deprecated due to large breaks in the API without the introduction of a stable replacement. Pull Requests to re-enable these data connectors are welcome.
Hahuong Giang (2 months ago)
hi, I have the same problem. Did you fix it?
John Cornan (3 months ago)
free cource on youtube must not be banned ........ plz govt's all country plz at least thing about poor student ... who can't afford expensive cource .... or middel class sstudent who cant ...... even afford collage fee ..... some.... we still try ... learn plz govt's plz don't ban free cource on youtube plz........
Thabang Tsajoa (3 months ago)
Hi Admin, can you please tell me the names of the books and other sources that I can use to learn about Algo strategies that are practical and helpful?thanks [email protected]
Joseph Foltz (3 months ago)
This is dope information. I'm an awesome trader, very profitable. You should make a tutorial on MQL4/5 showing how to make a forex scalp EA. I literally have a strategy backtested at 95% accuracy over years and years of data, I just dont know how to put it into code.
Cib (3 months ago)
For anyone having a problem with Google/morningstar api, try iex: 1. in cmd type pip install iex-api-python 2. and then just under df = web.DataReader put 'iex' instead of morningstar Hope that helps :)
Daniel Pelnar (1 month ago)
How come it works without installing iex-api-python (pip install iex-api-python)?
tiediealien (1 month ago)
Bless your soul. Thank you.
Filip Hupka (3 months ago)
Saved my day. Thanks alot
Marcus Jun (4 months ago)
Hi guys, for those who is facing difficulty from extracting stock price. Try quandl: import quandl as qdl import datetime as dt start = dt.datetime(2007, 1, 1) end = dt.datetime.today() amazon = qdl.get('WIKI/' + 'AMZN', start_date = start, end_date = end) print(amazon.head())
Mo Azim (4 months ago)
can you get a streaming data source from this, Similar to the tweepy video you did? It would be helpful for my side project to have streaming stock data with some indicators on top of the basic ones.
Vyas Nansen (4 months ago)
am a beginner. wondering how can i read line by line from DataReader to print it in a tabular format in python GUI using tkinter framework?
Samay Verma (4 months ago)
Is this still relevant in late 2018?
Swee Lee (2 months ago)
rather than trying to find the most "relevant" information out there, you might as well just start learning somewhere. this video is a fine place to start if you already know the basics of python.
Gabi Lehner (4 months ago)
how can I import data for all stocks? Not just a specific ticker?
Jonathan handoko (4 months ago)
cannot import style
Deon Sanchez (5 months ago)
'morningstar' has depreciated use 'yahoo' instead
Brunna T. (5 months ago)
is python 3.7 working with all the packages you are using?
فؤاادي احمد (5 months ago)
how to get streaming updated data from prices provider application like iqfeed ? thanks.
Joey Mizrahi (5 months ago)
could you please do a numpy tutorial
Martin Z (5 months ago)
@sentdex do you have a method for having this outcome with bonds? It would be amazing!
Richard Blackhound (5 months ago)
Interestingly, if you use Microsoft's Azure notebooks (free Jupyter notebooks in the cloud), the code works as in the video (including yahoo) as long as you put '!pip install pandas-datareader' (no quotes) on the first line
Karthik (5 months ago)
simple and neat.Thanks man you saved a lot of time for me.
Paltibenlaish (6 months ago)
Hi sentdex, thank you for sharing. I am beginner in python and I am wondering if it's not better to use JavaScript for example chart.js and analize stocks from jsons Apis. For a more comfortable enviourment regarding sharing via web/ Cheers
Martin Le (6 months ago)
Do you need Pyxll inorder to do this?
Stuti Rahul (6 months ago)
there is api from Tradermade that gives 6-month 60 minutes free data on over 80 currencies- http://dataapi.tradermadepro.com
Arv Vk (6 months ago)
how can i use csv file as data frame
irmscher9 (6 months ago)
Man, you are a star. That's exactly what I needed!
logic reason (6 months ago)
I run this: import datetime as dt import matplotlib.pyplot as plt from matplotlib import style import pandas as pd import pandas_datareader.data as web style.use('ggplot') start=dt.datetime(2000,1,1) end=dt.datetime(2016,12,31) and get this ================== RESTART: C:/Users/artna/Desktop/stock.py ================== Traceback (most recent call last): File "C:/Users/artna/Desktop/stock.py", line 6, in <module> import pandas_datareader.data as web File "C:\Users\artna\AppData\Local\Programs\Python\Python37\lib\site-packages\pandas_datareader\__init__.py", line 2, in <module> from .data import (DataReader, Options, get_components_yahoo, File "C:\Users\artna\AppData\Local\Programs\Python\Python37\lib\site-packages\pandas_datareader\data.py", line 14, in <module> from pandas_datareader.fred import FredReader File "C:\Users\artna\AppData\Local\Programs\Python\Python37\lib\site-packages\pandas_datareader\fred.py", line 1, in <module> from pandas.core.common import is_list_like ImportError: cannot import name 'is_list_like' from 'pandas.core.common' (C:\Users\artna\AppData\Local\Programs\Python\Python37\lib\site-packages\pandas\core\common.py) Windows 10, 64 bit Python version 3.7.0 IDLE version 3.7.0 Tk version 8.6.8 Please help
craig (6 months ago)
pd.core.common.is_list_like = pd.api.types.is_list_like paste the above before "import pandas_datareader.data as web"
Hongssi Ice (6 months ago)
#error 1.panda_datareader error ImportError: cannot import name 'is_list_like' import pandas ->pandas.core.common.is_list_like = pandas.api.types.is_list_like import pandas_datareader as web ref: https://stackoverflow.com/questions/50394873/import-pandas-datareader-gives-importerror-cannot-import-name-is-list-like 2.matplotlib error RuntimeError: Python is not installed as a framework. The Mac OS X backend will not be able to function correctly if Python is not installed as a framework. See the Python documentation for more information on installing Python as a framework on Mac OS X. Please either reinstall Python as a framework, or try one of the other backends. If you are using (Ana)Conda please install python.app and replace the use of 'python' with 'pythonw'. See 'Working with Matplotlib on OSX' in the Matplotlib FAQ for more information. ->import matplotlib as mpl ->mpl.use('TkAgg') import matplotlib.pyplot as plt from matplotlib import style ref:https://stackoverflow.com/questions/29433824/unable-to-import-matplotlib-pyplot-as-plt-in-virtualenv welcome
HB (6 months ago)
pd.core.common.is_list_like = pd.api.types.is_list_like
Battle Moose (7 months ago)
Code doesn't work. :(
sentdex (7 months ago)
Check comments. I believe atm Quandl or Robinhood work. The apis keep getting deprecated.
Bryan - (7 months ago)
you should watch your adds Sentdex. This fraud Jason Bond puts his BS as an add and it can kill this great sites credibility.
sentdex (7 months ago)
I have YT red and get no ads. I don't pick my ads, nor do most people. I'd like to think most people watching my programming/technical videos understand how ads work online and wouldn't fault me for it, instead just being happy for the free videos.
Prakash Praaku (7 months ago)
im not able to import pandas_datareader.data as web , pls help
Leif Leoden (7 months ago)
Okay so I install all the modules with `pip3 install pandas pandas_datareader matplotlib beautifulsoup4 scikit-learn` They install successfully, except for pandas_datareader due to an incompatible version of pandas. However, when I run the code I get an Import error saying I don't have matplotlib. I guess this is because I have multiple versions of python. So who do I find out the number of python versions I have running on my system and how do I force all them them to share modules?
Hungry Ham (7 months ago)
I have uploaded my notes and examples from this course: https://github.com/INASIC/Python-for-Finance They are quite comprehensive, and I hope they may be of help to anyone that is stuck with any bugs in the code presented in this series. In addition, they can be quickly skimmed to get a gist of what you might learn from this course, which I can also recommend. Best of luck, and enjoy 😊
Zach Marks (7 months ago)
getting an error that says: "cannot import name 'is_list_like'" -- any ideas on how to fix?
Buddhi Adhikari (6 months ago)
Add this line with you imports *pd.core.common.is_list_like = pd.api.types.is_list_like* Btw found this ans reading the comments but can't remember who wrote this ans
Dominickhrndz314 (7 months ago)
You can now use Robinhood in place of morningstar, google, and yahoo.
>>>import pandas_datareader as web Traceback (most recent call last): File "<pyshell#0>", line 1, in <module> import pandas_datareader as web File "C:\Python\lib\site-packages\pandas_datareader\__init__.py", line 2, in <module> from .data import (DataReader, Options, get_components_yahoo, File "C:\Python\lib\site-packages\pandas_datareader\data.py", line 14, in <module> from pandas_datareader.fred import FredReader File "C:\Python\lib\site-packages\pandas_datareader\fred.py", line 1, in <module> from pandas.core.common import is_list_like ImportError: cannot import name 'is_list_like' This is the other error when I try to import the module
Hi! ... I have a problem with pandas-datareader, python does not recognize it like a module: Traceback (most recent call last): File "getting_stock_price_data.py", line 5, in <module> import pandas_datareader as web ModuleNotFoundError: No module named 'pandas_datareader' But when I check my pip list, the panda-datareader 0.6 is already install. If you can help me with that, would be great.... Thanks
The Urbanist (7 months ago)
#Using Robinhood to make this look like tutorial # August 5, 2018 import datetime as dt import matplotlib.pyplot as plt from matplotlib import style import pandas as pd import pandas_datareader.data as web style.use('ggplot') start = dt.datetime(2000,1,1) end = dt.datetime(2018,7,31) df = web.DataReader('CNP', 'robinhood', start, end) df.reset_index(inplace=True) df.drop(['symbol', 'interpolated', 'session'], axis=1, inplace=True) df.rename(index=str, columns={'close_price': 'Close', 'high_price': 'High', 'low_price': 'Low', 'open_price': 'Open', 'volume': 'Volume', 'begins_at': 'Date'}, inplace=True) df.set_index('Date', inplace=True) df.head()
James Clark (6 months ago)
Thank you...only drawback with RH is that it only allows you to capture the last ttm worth of daily data.
Leonard Tan (6 months ago)
Works! Sadly there isnt data for Adjusted Close from Robinhood?
Buddhi Adhikari (6 months ago)
Better pin this comment
Buddhi Adhikari (6 months ago)
This works
Raman Ganti (7 months ago)
Google, Yahoo and recently Morningstar (https://stackoverflow.com/questions/51630874/getting-a-request-error-404-in-python-while-accessing-an-api) don't appear to work at the moment. The only one I was able to get working was quandl: ```df = web.DataReader("TSLA", 'quandl', start, end)''' You'll have to reverse the data frame so that it's in the same order as sentdex's: ```df = df.reindex(index=df.index[::-1])''' Beware that the column labels will be different (e.g. "AdjClose" instead of "Adj Close"). Also for anyone struggling with importing pandas_datareader, this may be your fix: https://stackoverflow.com/questions/50394873/import-pandas-datareader-gives-importerror-cannot-import-name-is-list-like
kashish (7 months ago)
Hello , i have installed all the packages , but while running the program it gives the error "import pandas_datareader.data as web" , "from .data import (DataReader, Options, get_components_yahoo," , "from pandas_datareader.fred import FredReader", "ImportError: cannot import name 'is_list_like'" , Can you help me where i am doing wrong . Thanks!
Quantumly (8 months ago)
This is pure gold... Saves so much time and energy than a CS/business degree. Thank you.
Jimmy Mosiah (8 months ago)
Hi sir, I'm applying your scripts in order to do my own market analysis(Optimal portfolio, CAPM..etc) but I'm getting this result: "NameError: name 'web' is not defined " should I define web? How to please? because I'm a biginner. Many Thx
Eshwaran K (8 months ago)
I installed all the packages with no errors. But i still get errors related to the packages. i use a 32 bit launcher on a 64 bit system . Pls help
Eshwaran K (8 months ago)
i get errors like cannot import is_list_like.... pls help
J Kl (8 months ago)
i have the latest python and the cmd code didn't work 'pip' is not recognized
ThePellski (7 months ago)
This tutorial uses Python 3.x, so you should be using the 'pip3' installer instead.
J Kl (8 months ago)
i have the latest python, how to install the packages?
Soelyla Salie (8 months ago)
import datetime as dt import matplotlib.pyplot as plt from matplotlib import style import pandas as pd pd.core.common.is_list_like = pd.api.types.is_list_like import pandas_datareader.data as web style.use('ggplot') start = dt.datetime(2000,1,1) end = dt.datetime(2017,12,31) df = web.DataReader('TSLA', 'morningstar', start, end) print(df.head())
Jean-Pierre Schnyder (8 months ago)
Just started the tuto. Looks very good ! Where can I find the python source files ?
Jean-Pierre Schnyder (8 months ago)
sentdex Thanks a lot. I am going to support you ...
sentdex (8 months ago)
Here you are: https://pythonprogramming.net/getting-stock-prices-python-programming-for-finance/
aneesh antony (8 months ago)
raceback (most recent call last): File "C:/Python36/project/webtest2.py", line 5, in <module> import pandas_datareader.data as web File "C:\Python36\lib\site-packages\pandas_datareader\__init__.py", line 2, in <module> from .data import (DataReader, Options, get_components_yahoo, File "C:\Python36\lib\site-packages\pandas_datareader\data.py", line 14, in <module> from pandas_datareader.fred import FredReader File "C:\Python36\lib\site-packages\pandas_datareader\fred.py", line 1, in <module> from pandas.core.common import is_list_like ImportError: cannot import name 'is_list_like' >>> Pls Help
aneesh antony (8 months ago)
thanks dear
Chih-Wei Yang (8 months ago)
This link maybe works for u. https://stackoverflow.com/questions/50394873/import-pandas-datareader-gives-importerror-cannot-import-name-is-list-like In addition, you probably to update the datareader by pip install git+https://github.com/pydata/pandas-datareader
Rahul Singh (8 months ago)
It says RemoteDataError
Rahul Singh (8 months ago)
Help me
eromattiffarg (8 months ago)
Took this course and just sold my own algorithm to BoA for $10 million yesterday Morning. Thanks for helping me take the first step.
humberto pérez (6 months ago)
donate something to sentdex lol
sentdex (8 months ago)
only 10million? Pocket change.
Dyn0might (8 months ago)
3:30 - 3:38, truth.
Tristan Shah (8 months ago)
for those having problems installing data reader via pip. Here is the latest dev version: pip install git+https://github.com/pydata/pandas-datareader.git
Greg Belcher (9 months ago)
If you get ImportError: cannot import name 'is_list_like' try pd.core.common.is_list_like = pd.api.types.is_list_like before running import pandas_datareader.data as web
Jan Gjerdum (8 months ago)
Cheers.
aniruddh sharma (8 months ago)
thanks
Greg Belcher (8 months ago)
aniruddh sharma New datareader documentation. The old way was more simple so I imagine there must be more functionality or features but I have no idea. I’m still new to Python so I have no perspective on the difference from the only way.
aniruddh sharma (8 months ago)
totally worked man!!, can you please explain what's the logic behind this
Lucas Carvalho (9 months ago)
It seems Yahoo API services don't work anymore... Is there another way to get finance data?
Wichary1 (9 months ago)
Hallo sentdex i have a problem: "ImportError: cannot import name 'is_list_like'" what i'm doing wrong can u help me?
Akash reddy EDA (9 months ago)
File "PythonProgramminp1.py", line 5, in <module> import pandas_datareader.data as web File "C:\Python35\lib\site-packages\pandas_datareader\__init__.py", line 2, in <module> from .data import (DataReader, Options, get_components_yahoo, File "C:\Python35\lib\site-packages\pandas_datareader\data.py", line 14, in <module> from pandas_datareader.fred import FredReader File "C:\Python35\lib\site-packages\pandas_datareader\fred.py", line 1, in <module> from pandas.core.common import is_list_like ImportError: cannot import name 'is_list_like'
Akshay Kadam (9 months ago)
will u please update me about the pandas_datareader cuz i m getting an import error
sentdex (9 months ago)
See the text-based tutorial here: https://pythonprogramming.net/getting-stock-prices-python-programming-for-finance/
Frostbiite (9 months ago)
Dude.., you are freaking amazing.
Aayesha Raj (9 months ago)
i m getting this error while running Traceback (most recent call last): File "C:/Users/Iqbal/AppData/Local/Programs/Python/Python36-32/Scripts/1.py", line 5, in <module> import pandas_datareader.data as web File "C:\Users\Iqbal\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pandas_datareader\__init__.py", line 2, in <module> from .data import (DataReader, Options, get_components_yahoo, File "C:\Users\Iqbal\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pandas_datareader\data.py", line 14, in <module> from pandas_datareader.fred import FredReader File "C:\Users\Iqbal\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pandas_datareader\fred.py", line 1, in <module> from pandas.core.common import is_list_like ImportError: cannot import name 'is_list_like'
Sebastian Devin Ryan (9 months ago)
Question here: I have been using morning star for my data source. I am iterating through a list of 500 stocks and some of the tickers that I am using are not producing a data frame. its not even throwing an error, its running the code without finishing and without progressing to the next ticker in my list. How do you recommend I have my program check if the data reader will produce a dataframe so that this doesnt happen? For context, one of the tickers that I am getting stuck on is QRTEA. Edit: After a very long time it finally outputted this error RuntimeError: maximum recursion depth exceeded while calling a Python object
L Pelz (9 months ago)
pip installed data-reader to site packages and now i get error when import pandas_datareader.data as web
Sam Goodwin (9 months ago)
Hi there, I'm just starting out with your videos and having troubles unfortunately. I've done most of what you did as well as include the changes I noticed in your recent comment to update the code. This is what I have: import datetime as dt import matplotlib.pyplot as plt from matplotlib import style import pandas as pd import pandas_datareader.data as web style.use('ggplot') start = dt.datetime(2010,1,1) end = dt.datetime.now df = web.DataReader('TSLA', 'morningstar', start, end) df.set_index("Date", inplace=True) df = df.drop("Symbol", axis=1) print(df.head()) ___________________________ It gives me a few error codes when I go to run it and I can't quite figure out what's going wrong. I'll copy those as well. Think you could have a look? I'm using PyCharm running 3.6 /Users/sam/PycharmProjects/untitled2/venv/bin/python /Users/sam/Library/Preferences/PyCharm2018.1/scratches/scratch_1.py Traceback (most recent call last): File "/Users/sam/Library/Preferences/PyCharm2018.1/scratches/scratch_1.py", line 5, in <module> import pandas_datareader.data as web File "/Users/sam/PycharmProjects/untitled2/venv/lib/python3.6/site-packages/pandas_datareader/__init__.py", line 2, in <module> from .data import (DataReader, Options, get_components_yahoo, File "/Users/sam/PycharmProjects/untitled2/venv/lib/python3.6/site-packages/pandas_datareader/data.py", line 14, in <module> from pandas_datareader.fred import FredReader File "/Users/sam/PycharmProjects/untitled2/venv/lib/python3.6/site-packages/pandas_datareader/fred.py", line 1, in <module> from pandas.core.common import is_list_like ImportError: cannot import name 'is_list_like' Process finished with exit code 1
Eduardo Reyna (9 months ago)
I had a similar issue, try the info of this link: https://stackoverflow.com/questions/50394873/import-pandas-datareader-gives-importerror-cannot-import-name-is-list-like?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa
Djino Zanko (10 months ago)
Hi, I get an PANDAS_DATAREADER ERROR although all packages are installed freshly ...line 5, in <module> import pandas_datareader.data as web File "/usr/local/lib/python3.6/site-packages/pandas_datareader/__init__.py", line 2, in <module> from .data import (DataReader, Options, get_components_yahoo, File "/usr/local/lib/python3.6/site-packages/pandas_datareader/data.py", line 14, in <module> from pandas_datareader.fred import FredReader File "/usr/local/lib/python3.6/site-packages/pandas_datareader/fred.py", line 1, in <module> from pandas.core.common import is_list_like ImportError: cannot import name 'is_list_like'
Danny Zilberg (10 months ago)
beautifulsoup4 didn't install, i managed to do it with calling it bs4
Marcel Mir (10 months ago)
Have you made money with that (honestly)?
Ezio Arno (10 months ago)
what font is he using? someone please reply
tiediealien (1 month ago)
looks like courier?
Dipam Vasani (10 months ago)
How can we use this for Indian stocks?
kentlord22 (11 months ago)
How do i get the stock for other country? lets say malaysia?
Mariano Abrile (11 months ago)
How can i set the last close price into a variable ?
Hamad Al Ali (11 months ago)
Thanks a lot for this. I TOTALLY appreciate it ! Do you have patreon ?
Rhodin (11 months ago)
now that yahoo and google have been deprecated, you should switch to something like alpha vantage, and the wrapper for python: https://github.com/RomelTorres/alpha_vantage essentially: pip install alpha_vantage and in your python script: from alpha_vantage.timeseries import TimeSeries ts = TimeSeries(key='YOUR_API_KEY', output_format='pandas') df, meta_data = ts.get_intraday(symbol='TSLA',interval='1min', outputsize='full') you can get your api key for free at alphavantage.co also im not sure about the start-end-thing, but their documentation should help with that
Steve SaMah (11 months ago)
Try 'Morningstar' instead of 'yahoo' or look at doc for alternatives.
Steve SaMah (11 months ago)
Try 'Morningstar' instead of 'yahoo' or look at doc for alternatives.
Steve SaMah (11 months ago)
Try 'Morningstar' instead of 'yahoo' or look at doc for alternatives.
Steve SaMah (11 months ago)
Try 'Morningstar' instead of 'yahoo' or look at doc for alternatives.
kennyPAGC (11 months ago)
Google and Yahoo finance are dead now. What are some alternatives for stock data? Stock, ETF and indices if possible.
sentdex (11 months ago)
Morningstar, or yahoo finance...with your own puller. The wiki dataset on Quandl also still works.
Ray Han (11 months ago)
Both yahoo and google APIs have been terminated? I seem to get errors for both portals o.o
sentdex (11 months ago)
Google should work, just limited.
Shawn Qiu (1 year ago)
Google has disabled the URL. Get out find another job!
Emanuel Girardi (1 year ago)
I'm just starting out, so sorry for the stupid question: But, how do I install / import these modules? Thanks a lot

Would you like to comment?

Join YouTube for a free account, or sign in if you are already a member.