

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://www.facebook.com/pythonprogramming.net/
https://plus.google.com/+sentdex
while running web.DataReader(‘GOOG’, ‘yahoo’, start, end), I get following error: RemoteDataError: No data fetched using ‘YahooDailyReader’ – how to debug it?
does this still work? yahoo seems down?
Hello! Thank you for these tutorials, they are awesome. Can you recommend any good book(s) about analytics with Python?
I can’t install pandas on my machine (MacBook), can you help pls?
I wrote down exactly what you did for the first example, but got the following error, why? I have version 3.6.1.
AttributeError: module ‘pandas_datareader.data’ has no attribute ‘datareader’
Cool, I’ve been writing a complete Bitcoin trading app for the past week or two, so this could end up being a good reference and source of ideas like your previous finance videos.
I hope you’ll at least touch on genetic algorithms when backtesting, you mentioned them in passing before but never really covered them, and it would be awesome to see your take on them.
got it. used google
Thankyou very much for sharing your python knowledge with us online. It’s been fun learning python on my PC using your videos alongside other materials. As per your advice, I am now ready to start my project. I hope this will bring me some financial freedom and a route out of the rat race. I would like to learn to integrate my python code and display results like graphs, calculations on a website. The idea is to create a prototype. Do you have any suggestions? I noticed that for graphs you have been using static png files. Thank you very much.
Edward can you please add the code as part of the video series. It’s inefficient for us to pay attention to the lesson while trying to keep up with typing
Does anyone get also the error: AttributeError: ‘_NamespacePath’ object has no attribute ‘sort’ :S
I installed all the libraries you mentioned and ran the script but got an error. It says "No such file or directory: ‘gg.plot’ and ‘OSError: ‘gg.plot’ not found in the style library and input is not a valid URL or path.’ I’ve found many sites about how to install gg.plot but they won’t install properly. Is there another library/package I can install and also get gg.plot? I installed Python 3.5 on Windows 10 64bit.
This was the error when I tried to implement the above code:-
Traceback (most recent call last):
File "E:Codesentfin1.py", line 11, in <module>
import pandas_datareader.data as web
File "C:UsersMy ComputerAppDataLocalProgramsPythonPython36libsite-packagespandas_datareader__init__.py", line 3, in <module>
from .data import (get_components_yahoo, get_data_famafrench, get_data_google, get_data_yahoo, get_data_enigma, # noqa
File "C:UsersMy ComputerAppDataLocalProgramsPythonPython36libsite-packagespandas_datareaderdata.py", line 7, in <module>
from pandas_datareader.google.daily import GoogleDailyReader
File "C:UsersMy ComputerAppDataLocalProgramsPythonPython36libsite-packagespandas_datareadergoogledaily.py", line 1, in <module>
from pandas_datareader.base import _DailyBaseReader
File "C:UsersMy ComputerAppDataLocalProgramsPythonPython36libsite-packagespandas_datareaderbase.py", line 13, in <module>
from pandas_datareader._utils import (RemoteDataError, SymbolWarning,
File "C:UsersMy ComputerAppDataLocalProgramsPythonPython36libsite-packagespandas_datareader_utils.py", line 5, in <module>
from pandas.core.common import PandasError
ImportError: cannot import name ‘PandasError’
Hi, I am using python36 and pip installed pandas datareader, yet it pumps me an error when I trying to
import pandas_datareader.data as web
this is the error return ;
Traceback (most recent call last):
File "F:DownloadsPython Worktry figuring thigns outfinancetry.py", line 1, in <module>
import pandas_datareader.data as web
File "C:Python36libsite-packagespandas_datareader__init__.py", line 3, in <module>
from .data import (get_components_yahoo, get_data_famafrench, get_data_google, get_data_yahoo, get_data_enigma, # noqa
File "C:Python36libsite-packagespandas_datareaderdata.py", line 7, in <module>
from pandas_datareader.google.daily import GoogleDailyReader
File "C:Python36libsite-packagespandas_datareadergoogledaily.py", line 1, in <module>
from pandas_datareader.base import _DailyBaseReader
File "C:Python36libsite-packagespandas_datareaderbase.py", line 13, in <module>
from pandas_datareader._utils import (RemoteDataError, SymbolWarning,
File "C:Python36libsite-packagespandas_datareader_utils.py", line 5, in <module>
from pandas.core.common import PandasError
ImportError: cannot import name ‘PandasError’
I was trying to lookup online yet I could not find any solution, anybody can help?
Does the yahoo finance api not work anymore?
Thank you very much for this series. 🙂 🙂
Do you use Git?
I love your content so much, really. Your stuff is amazing <3
Thanks so much for this series of tutorial. They are so helpful! Just wonder where I can find the source code of this tutorial.
This is exactly y I am learning python. I’m not at the level yet to dive into this video but I’ll be back in a few days. Thank you so much for this.
Hello, I”m having serious trouble installing scikit-learn. Using CMD to intall, I get the message "Scientific Python (SciPy) is not installed." BUT THEN, when I try to install SciPy, this is the message I get
Command "c:userscedricappdatalocalprogramspythonpython36-32python.exe -u
-c "import setuptools, tokenize;__file__=’C:\Users\cedric\AppData\Local\Te
mp\pip-build-mfrz88kv\scipy\setup.py’;f=getattr(tokenize, ‘open’, open)(__fil
e__);code=f.read().replace(‘rn’, ‘n’);f.close();exec(compile(code, __file__,
‘exec’))" install –record C:UserscedricAppDataLocalTemppip-kpaqyonj-recor
dinstall-record.txt –single-version-externally-managed –compile" failed with
error code 1 in C:UserscedricAppDataLocalTemppip-build-mfrz88kvscipy
Don’t know what to do and I really need this for work
u r smart
I love your stuff! Glad to see you are posting more and more videos.
Can I use this on Quantopian or do I need to actually download the files mentioned?
Help 🙁 I get this error:
File "E:My programsPythonAnacondalibsite-packagespandas_datareaderbase.py", line 120, in _get_response
raise RemoteDataError(‘Unable to read URL: {0}’.format(url))
RemoteDataError: Unable to read URL: http://ichart.finance.yahoo.com/table.csv?a=0&ignore=.csv&s=TSLA&b=1&e=17&d=4&g=d&f=2017&c=2000
Though not necessary for this tutorial, I was unable to install scikit-learn. The error msg said scipy is needed. When I attempted to install it an error occurred saying I should use pip for installing, which I’m using. I went to the scikit-learn website mentioned in the error msg, but it wasn’t really helpful. Has anyone else had problems installing scikit-learn? Any help is appreciated.
In case you are wondering, Edward Snowden is using idle3. Type idle3 in your terminal and it should open it. Then go to file and open. That should get you to a similar screen as him.
So i get an attribute error when i try to run this code. Googling gets me to tpoics saying that it is an issue with pandas being used instead of pandas_datareader. What do you do to solve this?
I had to change the datareader to:
web.DataReader("NASDAQ:TSLA", ‘google’, start, end)
instead, as yahoo was not giving me info
( RemoteDataError: Unable to read URL: … )
Could you help me with getting whole output with all prices? 🙂
as an output I get only this
2011-01-11 126.248814
2011-01-12 127.808929
…
2015-10-20 133.165604
first 30 and last 30 values
with code print(df)
can you some basic videos on python for absolute beginners
Can get DateTime Module to work 🙁 using Ubuntu 16.04 HELP!
always get:
import datatime as dt
ImportError: No module named datatime
I missed your videos @sentdox.. You made a huge surprise..
You should do a series about finding an edge in trading with Python! With futures too, not always stocks etc.
Which IDE do you use for Development ?
hi, i’m having trouble fetching the data from yahoo. your code gives me the following error:
RemoteDataError(‘Unable to read URL: {0}’.format(url))
pandas_datareader._utils.RemoteDataError: Unable to read URL:
upload videos at slow rate.. 😛 because if you start uploading any shit named as python… my entire day will be lost from college assignments and projects becoz i keep on listening to your idle 😛 /…..ha ha…. dude your tutorials are awesome 🙂
please complete drone tutorials asap ………
Hey how do we do this for forex trading can you please consider currency pairs instead of stocks please
Can we use pycuda for doing the hard work ??
Hey! i have this error message : AttributeError: module ‘pandas_datareader.data’ has no attribute ‘Datareader’. When i install it on my computer it says " Requirement already satisfied" so i guess i have already downloaded it. I can’t see what I did wrong. can someone help?
Dude Brilliant! I hope you can teach us how to get fundamental data outside of the Quantopian API also!
for the example you have shared , i am getting error with import pandas_datareader.data as web. Do i need to do it in different way
can you some basic videos on python for absolute beginners
As soon as I pressed that F5…..WHAT IS THIS VOODOO THAT YOU SHOW ME???!?!?!?
8:08
I love how the tail needs more space just because Tesla’s stock rose so extremely 😀
I keep getting import _tkinter # If this fails your Python may not be configured for Tk
ImportError: No module named _tkinter on fedora yet I have tk-devel and tcl-devel installed :/
you are awesome! my hero!
Extremely frustrating have been trying to get Python up and running and getting all sorts of errors.
Thanks a lot 🙂 eternally grateful for your efforts . One stop for python !!
No thumbs down 🙂 everyone loves you
Hi!! is it possible to get the minute data instead of the daily data from yahoo api?