Regression Intro - Practical Machine Learning Tutorial with Python p.2

Поділитися
Вставка
  • Опубліковано 30 вер 2024
  • To begin, what is regression in terms of us using it with machine learning? The goal is to take continuous data, find the equation that best fits the data, and be able forecast out a specific value. With simple linear regression, you are just simply doing this by creating a best fit line.
    From here, we can use the equation of that line to forecast out into the future, where the 'date' is the x-axis, what the price will be.
    A popular use with regression is to predict stock prices. This is done because we are considering the fluidity of price over time, and attempting to forecast the next fluid price in the future using a continuous dataset.
    Regression is a form of supervised machine learning, which is where the scientist teaches the machine by showing it features and then showing it was the correct answer is, over and over, to teach the machine. Once the machine is taught, the scientist will usually "test" the machine on some unseen data, where the scientist still knows what the correct answer is, but the machine doesn't. The machine's answers are compared to the known answers, and the machine's accuracy can be measured. If the accuracy is high enough, the scientist may consider actually employing the algorithm in the real world.
    pythonprogramm...
    / sentdex
    / pythonprogramming.net
    plus.google.co...

КОМЕНТАРІ • 1,4 тис.

  • @phoneAntics
    @phoneAntics 8 років тому +880

    If anyone's getting a "No module named 'Quandl'" error I fixed mine by changing all the 'Quandl's to lowercase.

    • @RandomAlexus
      @RandomAlexus 8 років тому +24

      We were likely researching this at the same time lol.

    • @sentdex
      @sentdex  8 років тому +153

      It's lower-cased now.

    • @tahaahmed9037
      @tahaahmed9037 8 років тому +34

      Didn't worked for me in the lower case either

    • @humantrailmachine
      @humantrailmachine 8 років тому +8

      lower-cased work for me ...

    • @vinaykr1991
      @vinaykr1991 8 років тому +22

      well if you are using anaconda do a "conda install quandl" which will take care of it. or pip install quandl should do it.

  • @DavidChukwuemeka-kz1yr
    @DavidChukwuemeka-kz1yr 2 місяці тому +8

    anyone here in 2024

  • @arsh5967
    @arsh5967 7 років тому +310

    Never thought Snowden would turn to UA-cam tutorials to support himself.
    Amazing video btw!

    • @veraalex7446
      @veraalex7446 5 років тому +1

      hhhh true

    • @AndreyEvermore
      @AndreyEvermore 5 років тому +7

      Honestly a compliment Snowden’s a hero

    • @radioactive11
      @radioactive11 4 роки тому +1

      oh hey there

    • @attaulmomin
      @attaulmomin 4 роки тому +1

      I was thinking the same .He time travelled back after he got an advice from Joe Rogen .lol

  • @anandiborade6349
    @anandiborade6349 3 роки тому +29

    He: uses pure python ide for Machne Learning (Expert teaching Machine Learning)
    Me: using Jupyter notebook for learning Machine Learning

  • @abhishekshah8867
    @abhishekshah8867 6 років тому +179

    If you're getting a No module named 'Quandl' error , change all the 'Quandl' to 'quandl' .
    Quandl has now changed . So first go create a free account , confirm your mail id and then copy the API key and do this .
    import pandas as pd
    import quandl
    quandl.ApiConfig.api_key = 'your_api_key_here'
    df = quandl.get('WIKI/GOOGL')
    print(df.head())

  • @bbbbbbLunTeDDDDDDD
    @bbbbbbLunTeDDDDDDD 5 років тому +44

    "So the equation of a line... well, we'll talk about more down the line." Heh, nice pun man. Made me chuckle

  • @TTTT-rw7xt
    @TTTT-rw7xt 8 років тому +99

    I get so many errors wile typing the same thing it's inhumane lol.

    • @dudebro4421
      @dudebro4421 7 років тому +2

      yo sammmeee

    • @charonder
      @charonder 4 роки тому

      @@dudebro4421bro haha no way dude

  • @planetpeter917
    @planetpeter917 8 років тому +219

    Don't you want HL_PCT as (high-low)/low

    • @sentdex
      @sentdex  8 років тому +159

      Yep, I derped.

    • @demogorgon5778
      @demogorgon5778 7 років тому +3

      So should i change it accordingly?

    • @Manojsinghnegiwd
      @Manojsinghnegiwd 7 років тому +2

      Yeah you should :)

    • @armv7-m603
      @armv7-m603 6 років тому +63

      Thank god someone else spotted this, I thought I was stupid for not understanding.

    • @aakashdusane
      @aakashdusane 6 років тому +9

      Percentage change is (initial - final) / initial
      so shouldn't it be (high-low)/high ??

  • @23deepakiyer76
    @23deepakiyer76 3 роки тому +24

    i am 13 years old rn and i am commenting this so i can come back here years later and say- yea, this is where i started

  • @JackMCGamerAnimations
    @JackMCGamerAnimations 4 роки тому +8

    I just don't understand this. I was never familiar with Stock Market and stuff like that. I can see what you are doing, but I don't know *why* you are doing.

    • @emmanuelmberu18
      @emmanuelmberu18 3 роки тому

      Easiest thing you can do or best thing you can do is get yourself familiar with it, atleast to the point where what he's saying makes sense...but at the end of the day it's just an example, as long as you understand the concepts

  • @JohnDupuyCOMO
    @JohnDupuyCOMO 8 років тому +54

    I suspect that for line defining 'HL_PCT', you meant to subtract/divide with 'Adj. Low' rather than 'Adj. Close' to get volatility. Looking forward to your vids! You do great tutorials.

    • @sentdex
      @sentdex  8 років тому +33

      +John Dupuy You suspect right! Watched it probably 3 times before publishing, then saw my mistake, d'oh! Luckily, this is just meant to be a super simple example of creating features. That is an interesting feature, though definitely not what was intended. Hopefully you are better than me at the process, and nice catch :P

    • @legel93
      @legel93 8 років тому +3

      +John Dupuy thought of the same thing! When I saw the comment I had my little HA! moment haha :). Great video btw +sentdex thanks for putting out all this content!

    • @aikimark1955
      @aikimark1955 8 років тому

      +John Dupuy Thanks.

    • @MatMatJamar
      @MatMatJamar 8 років тому +1

      +LefkiosG Same :D

    • @datapiburma6908
      @datapiburma6908 6 років тому

      sry for my dumb question , why this subtract/divide process is done ? This is dealing with stock calculation? I'm really confusing and getting nervous in finding df[HL_PCT] & df[PCT_Change] :(

  • @roya6619
    @roya6619 7 років тому +3

    df1 = quandl.get_table('WIKI/PRICES')
    df = df1[['date','adj_open','adj_high','adj_low','adj_close','adj_volume']]
    df.index.names = [None]
    df=df.set_index('date')
    change the df like the above code for those who are using the new google data. the indexes are not date any more that's the reason the following part doesn't work.
    last_date = df.iloc[-1].name
    #print (df.index[-1],last_date)
    last_unix = last_date.timestamp()
    one_day = 86400
    next_unix = last_unix + one_day

    • @graysoncroom
      @graysoncroom 7 років тому +1

      Roya Norouzi Thanks for your notes. Saved me from having to go through the docs. Cheers.

  • @ufotofu9
    @ufotofu9 5 років тому +18

    You now have to use a lowercase 'q' for Quandl:
    import quandl
    df = quandl.get('WIKI/GOOGL')

    • @yashpandey350
      @yashpandey350 4 роки тому

      Absolutely right. Otherwise, an error came up and you waste a lot of your time juggling around why this is not working?

    • @rahadulhaq6387
      @rahadulhaq6387 4 роки тому

      Than you so much my brother :)...only for u i can make it

    • @aaronkaiser5140
      @aaronkaiser5140 4 роки тому

      I wish I had seen this soon, but after a while I stumbled upon this solution after trying to get quandl into anaconda and seeing it was lowercase.

    • @insipidly
      @insipidly 2 місяці тому

      thanks

  • @lakchchayamdivyakhare2163
    @lakchchayamdivyakhare2163 4 роки тому +5

    Guyzz for following this tutorial in 2020 you need to have an account in Quandl and must confirm account to access data by API key
    This code works in 2020✔✔✔
    import pandas as pd
    import quandl
    quandl.ApiConfig.api_key = 'Your Api key'
    df = quandl.get('WIKI/GOOGL')
    print(df.head())

  • @rebelScience
    @rebelScience 5 років тому +5

    WIKI/GOOGLE is not available anymore. Can;t find a similar data set to follow this tutorial.

    • @AzurePain
      @AzurePain 5 років тому +1

      Same. Looking for an alternative. If I find it, I'll post a link here.

    • @rishikaley83
      @rishikaley83 5 років тому +1

      It is 'WIKI/GOOGL'

  • @mickelodiansurname9578
    @mickelodiansurname9578 7 років тому +8

    Quandl seem to have changed their simple price call to free data to an API key and request model plus a signup is needed even for free data.
    heres what I got when set an account up on Quandl in terms of the python code for a script...
    quandl.ApiConfig.api_key = 'xxxxxxxxxxxxxx''
    data = quandl.get_table('WIKI/PRICES')
    This sort of makes your tutorial, as far as I can see, stop dead at the point of reference to Quandl.get('WIKI/GOOGL') as this just don't work no more.
    although to be fair they do still say here that you can just call the prices in, as you outlined, without any need for a key -> www.quandl.com/tools/python

    • @LeoRFTS
      @LeoRFTS 7 років тому

      Quandl.get('WIKI/GOOGL') still works without an API key, the thing is that on the quandl website now WIKI/GOOGL, which wasn't in table format, redirects to WIKI/PRICES. Their site seems buggy to me. I started with WIKI/PRICES and API key as well because I'm not like the mindless people who just imitate what they see on a video. Here is another technical link:
      github.com/quandl/quandl-python/blob/master/FOR_ANALYSTS.md

    • @TXfoxie
      @TXfoxie 4 роки тому

      Seems like the first stock request is for free. You can do it anonymously. Then the second request of different stock, they may ask you for API keys. You can register a quandl account for free and you will be given you a permanent API key as long as you confirm your email address.

  • @baibhavipandey4814
    @baibhavipandey4814 10 місяців тому +3

    quandl website is completely different now I cannot find anything their

    • @machinacheater7725
      @machinacheater7725 3 місяці тому

      Tbh it’s not hard to use. Okay to use the wiki you don’t have to go website. Ngl the website is mess. The trick is add quote marks a / then stock ticker symbol. Just search company ticker symbol use google. It gets data for that company. Example df= qunadl.get(‘WIKI/F’). Note don’t forget to import quandl and print(df)

    • @ramsayboltonn
      @ramsayboltonn 3 місяці тому

      @@machinacheater7725 Thank you dude

  • @sam18nr
    @sam18nr 7 років тому +9

    For those who have installed Python 3.6 and having problems installing sklearn .. save some time and check this link
    stackoverflow.com/questions/42360126/error-while-trying-to-install-sklearn-from-pycharm-arrayobject-h-cannot-be-abs

  • @user-oh4vm2kv5r
    @user-oh4vm2kv5r 8 років тому +29

    ubuntu/ linux users
    if you got any error installing quandl, just type pip3 install quandl. worked to me!

    • @jackc7069
      @jackc7069 7 років тому

      Thank you!!!

    • @pedrobarbosa8360
      @pedrobarbosa8360 7 років тому

      Thanks bro , save my life

    • @AIandtheworld
      @AIandtheworld 7 років тому

      geniusss! thanks!

    • @lennartlut
      @lennartlut 7 років тому

      its also an improvement for mac users

    • @lennartlut
      @lennartlut 7 років тому

      whats the difference between pip and pip3?

  • @peluso_palit
    @peluso_palit 5 років тому +17

    import pandas as pandas
    import quandl
    df = quandl.get("WIKI/GOOGL")
    print(df.head())
    #quandl should be lowercase
    3 April 2019

  • @syedishtiyaqahmed2376
    @syedishtiyaqahmed2376 5 років тому +36

    I'm happy that people like you exist . In Indian engineering colleges we dont have courses on ML in the computer science stream . Thanks a lot !

    • @thelasttimeitookashowerwas7069
      @thelasttimeitookashowerwas7069 4 роки тому +10

      well youre studying in the wrong college buddy! VIT has it!

    • @siddhantsingh3392
      @siddhantsingh3392 4 роки тому +17

      Yeah just pay 16 lakhs. They will teach you ML and provide jobs for spreadsheet and excel lmao.

    • @notagamer32
      @notagamer32 4 роки тому +4

      @@siddhantsingh3392 So true LMAO

    • @TheWohnJick
      @TheWohnJick 4 роки тому +2

      @@pranavsebastianlouis may be he misinterpreted Madrasa as engineering college

    • @Enem_Verse
      @Enem_Verse 3 роки тому

      What are you talking about

  • @ComputersAreRealCool
    @ComputersAreRealCool 7 років тому +264

    My mind was blown when you said "y = mx + b", when my entire life I have been using "c" not "b". Great video though :)

    • @prakharmishra6697
      @prakharmishra6697 7 років тому +7

      Wow, really?

    • @kelbiekelbie909
      @kelbiekelbie909 7 років тому +6

      I use c also. Makes it easier to remember the other formula y-b=m(x-a)

    • @blazstempelj7999
      @blazstempelj7999 7 років тому +33

      I was taught y = kx + n

    • @kelbiekelbie909
      @kelbiekelbie909 7 років тому +17

      Blaž Štempelj
      It really doesn't matter. c, n, b as long as we all know what each other mean its the same formula!:)

    • @blazstempelj7999
      @blazstempelj7999 7 років тому +8

      Totally agree. It's just interesting to see different notations :)

  • @AxelKingsley
    @AxelKingsley 7 років тому +20

    No idea if you catch it in a future video, but I noticed a bug in your feature definition. Your "volatility" measurement should be calculated with high and low, but you are using high and close. I may misunderstand the feature, but you even labeled it HL_PCT.

    • @partha95123
      @partha95123 6 років тому +2

      Yes it should be high minus low!! In his official website he has mentioned this correction.

    • @ankitsahay3625
      @ankitsahay3625 6 років тому +2

      What's his official website?

    • @partha95123
      @partha95123 6 років тому +1

      pythonprogramming.net/

    • @miguelcastillo1742
      @miguelcastillo1742 5 років тому

      Ahhh, so that's what got me confused.
      I did not understand that part of the video, but I get it now.
      Thank you

    • @AdarshNamboothiri
      @AdarshNamboothiri 5 років тому +1

      Are we really having a stock exchange classes here :p

  • @Ai-iann
    @Ai-iann 2 місяці тому +3

    Hello. I’m trying to follow along and it seems Quandle has changed a lot since the last time you used it. For starters, nothing’s free anymore. Found this out after downloading the whole series …

    • @maalolangm
      @maalolangm 16 днів тому

      does he use quandl for all other vidoes? im just gettin started rn

    • @glec5661
      @glec5661 5 днів тому +1

      real

  • @chaityapatel2703
    @chaityapatel2703 5 років тому +10

    7:32 : In creating features, shouldn't High-Low percentage be 'High - Low' instead of 'High - Close'. Just an observation.

    • @rohanaggarwal8718
      @rohanaggarwal8718 4 роки тому +1

      I noticed that too I don't know if he did it on purpose or not

    • @chaityapatel2703
      @chaityapatel2703 4 роки тому +1

      @@rohanaggarwal8718 9 Months in, almost impressive!

    • @ishitashah220
      @ishitashah220 4 роки тому

      I think so too!

    • @anshshrivastava9107
      @anshshrivastava9107 4 роки тому

      @@ishitashah220 Is that correct or should that be high-low?

  • @nickr.feller6246
    @nickr.feller6246 8 років тому +73

    Quandl is quandl (small case) for me

    • @sentdex
      @sentdex  8 років тому

      +Nick R. Feller Thanks for sharing, wonder why this is different for some people. Are you using a different version of Python?

    • @nickr.feller6246
      @nickr.feller6246 8 років тому

      +sentdex python 3.5

    • @MolecularArchitect
      @MolecularArchitect 8 років тому

      +sentdex I'm on a Mac using 2.7 and it is lowercase too

    • @danielmbicalho
      @danielmbicalho 8 років тому

      The same for me. Using Debian 8 and python 2.7.9

    • @CarsonJamesCook
      @CarsonJamesCook 8 років тому

      It's also lower case for me. Using 3.5.1 on OSX.

  • @realmrjangoon
    @realmrjangoon 4 роки тому +13

    I was able to access wiki/googl via python but couldnt find it anywhere on the actual website for the life of me

    • @nq2c
      @nq2c 4 роки тому +2

      same haha

  • @tbass134
    @tbass134 7 років тому +5

    the quandl site changed a bit since the video was recorded, if you try to use `WIKI/GOOGL`, you receive an error '(Status 403) (Quandl Error QEPx04) You do not have permission to view vendor datatable 'WIKI/GOOGL'. Please subscribe to this database to get access to the data.'
    to fix, just use `quandl.get_table('WIKI/PRICES', ticker='GOOGL')`
    also, note that the index is different than in the video. In the latest version in Quandl, the index is NOT the date. In order to make the index the date, like in the video do:
    df.set_index(['date'], inplace = True, drop=True)
    then everything in the original example will work without having to modify anything else

    • @ulrichzentis3035
      @ulrichzentis3035 7 років тому

      df = Quandl.get('WIKI/GOOGL')
      print(df.head)
      works for me and shows the Dataframe.

    • @tbass134
      @tbass134 7 років тому +1

      weird... I'll try again.
      thanks for trying!

    • @ulrichzentis3035
      @ulrichzentis3035 7 років тому

      import quandl as Quandl
      df = Quandl.get('WIKI/GOOGL')
      print(df)
      --
      Trying out your code leads to an error which says that an API key is needed
      I'm using Quandl 3.1.0 without providing an API key, with python 3.4.3 on PyCharm / macOS

    • @saminyeasararnob1810
      @saminyeasararnob1810 7 років тому

      I'm having the same problem. Let me know if you could solve the issue

    • @tbass134
      @tbass134 7 років тому

      I was able to confirm that this does work for me. Using python 2.7.11 Very strange why it wasn't working for me before

  • @danielrousseau6541
    @danielrousseau6541 6 років тому +4

    im also getting this error.......``` File ".\Main.py", line 8, in
    mydf["HL_PCT"] = (mydf["Adj. High"] - mydf["Adj. Close"]) / mydf["Adj. Close"] * 100.0
    TypeError: list indices must be integers or slices, not str```

    • @Mahdi-ug1qy
      @Mahdi-ug1qy 5 років тому +1

      i have the same issue. did you ever solve it?

    • @sravanikatasani6502
      @sravanikatasani6502 3 роки тому

      please try enclosing Adj. High,Adj. Close and HL_PCT in a single quotation mark..not double

  • @anejatu1312
    @anejatu1312 6 років тому +5

    Your videos are awesome, but i,m a beginner and i think you should make simple regression videos with simple data, thanks

    • @sentdex
      @sentdex  6 років тому +4

      I thought that's what this was :O

  • @nadekang8198
    @nadekang8198 6 років тому +5

    If you are using jupyter lab or jupyter notebook, in addition to installing using pip install quandl, open the anaconda cmd, and install conda install quandl to import to jupyter.

  • @abrahamren7553
    @abrahamren7553 10 місяців тому +1

    another change is if you use pycharm, Instead of using print(df.head), you should use print(df.head()) with parentheses.

  • @arula10101
    @arula10101 7 років тому +30

    Hi! I am loving your videos!
    There is a small typo on this one. The HL_PCT should have the Adj. Low instead of Adj. Close in the formula. Nothing much, but I thought I should say it so that someone who might want to use the code gets it right.
    Please keep up with the excellent content! S2

    • @surbhirohilla3804
      @surbhirohilla3804 Рік тому

      Could you also tell me that what does this mean "(high - low)/low" .Is this any formula or something else .Please help

    • @madlad5711
      @madlad5711 Рік тому

      @@surbhirohilla3804 use chatgpt , its gonna help you

    • @michaelackerman2660
      @michaelackerman2660 Рік тому

      @@surbhirohilla3804 In this example, he is trying to get percentage difference in the high and low values. This is just the percentage difference formula.

  • @whatdoiputhere5089
    @whatdoiputhere5089 3 роки тому +1

    Alteast have some ads. It really feels bad to watch this videos for free dude!

  • @ajustice2527
    @ajustice2527 5 років тому +10

    "I just feel light there's a disconnect between your version and mine"

  • @laurynas.k
    @laurynas.k 8 років тому +8

    If any one like me is facing quandl error in ubuntu os, here is solution for that stackoverflow.com/questions/38427430/error-installing-quandl-with-pip-on-ubuntu-14-04

    • @MikeDrones
      @MikeDrones 8 років тому +1

      also with pip install sklearn, errors. im going to try using anaconda -it ships with stable sklearn

    • @laurynas.k
      @laurynas.k 8 років тому

      MikeDrones Yeah another solution could be anaconda... also it is important that some python packages could be 64bit versions also so if solution did not work for someone, so google that same package for 64bit version..

    • @amartyasingh09
      @amartyasingh09 8 років тому +1

      THIS WORKS!!!! Enabling Quandl was huge pain, untill now.

    • @MikeDrones
      @MikeDrones 7 років тому

      Sweet

    • @m_explorer
      @m_explorer 7 років тому +2

      Thanx it works to me now :D

  • @seanbarnard8598
    @seanbarnard8598 6 років тому +5

    Quandl changed :( I can't find abundant free databases on it anymore. I guess I will just walk into a den of lions. And also add what lines of code I am graced with based on my malnourished quandl sample.

    • @hamad.learns
      @hamad.learns 6 років тому +1

      try setting an account on Quantopian. You get access to a ton of stock databases

    • @moizvirani5425
      @moizvirani5425 5 років тому

      I think quandl is still giving some free datasets not exactly what it is shown in tutorial though.

  • @bharathbn9225
    @bharathbn9225 2 роки тому +1

    KeyError: "None of [Index(['adj.open', 'adj.high', 'adj.low', 'adj.close', 'adj.volume'], dtype='object')] are in the [columns]" .........after running this line help me ...df1 =df1[['adj.open','adj.high','adj.low','adj.close','adj.volume',]]

  • @MeghanmarinePrior
    @MeghanmarinePrior 4 роки тому +4

    Got through this tutorial. Felt super confused at first but I watched it again and it made a lot more sense.

  • @floheissler2336
    @floheissler2336 5 років тому +2

    FOR LINUX USERS IN 2018:
    You definitely wanna use a virtual environment for this one, easiest way is to get anaconda
    1. download from anaconda.org, then cd ~/Downloads and run with 'bash Anaconda-......' to install anaconda. after that open new console to activate
    2. Create a virtual environment using python3.5 (like sentdex) and install pip with: conda create --name python=3.5 pip
    3. You can now check your environments with 'conda env list'. Activate your env with 'conda activate (to deactivate simple 'conda deactivate'
    4. now that you are in your virtual environment 'python --version' should yield 3.5...
    5. Now you can simply your (from command prompt) 'pip install sklearn/quandl/pandas' and all should go smooth (pandas is now included in quandl)
    Hope this helped.... took me 2 hours.... :/

  • @aryaanand759
    @aryaanand759 6 років тому +3

    Hi! Should I start with this tutorial series just after watching the first 15 videos of python with no prior knowledge in math topics related to machine learing?? Or should I do something else first? I would highly appreciate if someone could help me out.

    • @anshshrivastava9107
      @anshshrivastava9107 4 роки тому

      I also have the same question, I suppose now you know what do I do?

  • @mostafamohamad8210
    @mostafamohamad8210 2 роки тому +2

    anyone have quandl data link ??

  • @jpggvilaca
    @jpggvilaca 8 років тому +7

    just started learning and I must say, amazing explanations man. Thanks a lot!

    • @sentdex
      @sentdex  8 років тому +1

      Great to hear! Best wishes on your ML journey!

  • @AmandeepSingh-kl5lv
    @AmandeepSingh-kl5lv 5 років тому +2

    what is df exactly? a dictionary of lists, but how you are using it, i mean by this - df[['xyz', 'abc']]
    brackets in brackets
    you cant use keys list to redefine dictionary

  • @siddheshbalsaraf1776
    @siddheshbalsaraf1776 3 роки тому +3

    ok i get it now ..if u are having trouble downloading the dataset just use api key statement like this quandl.ApiConfig.api_key = "your api key after creating free acc " and then use quandl.get statement it works !

  • @soheilah1363
    @soheilah1363 3 роки тому +1

    If anyone is getting "ValueError: check_hostname requires server_hostname" error just install this:
    pip install urllib3==1.25.8

  • @dermorgendanach93
    @dermorgendanach93 8 років тому +4

    hello! I've been stucked with this error, please somebody can help me, thanks
    line 6 in df['HL_PCT'] = (df['Adj. High'] - df['Adj. Close']) / df['Adj. Close'] * 100.0
    TypeError: list indices must be integers or slices, not str
    I'm working with python 3.5.2 and have exactly the same code.

    • @abdulawad1899
      @abdulawad1899 8 років тому +2

      I' m stucked too with this error, are you get the answer thanks

    • @dermorgendanach93
      @dermorgendanach93 7 років тому +9

      Hello!, I just worked it out. In this line "df = df[["Adj. Open", "Adj. High", "Adj. Low", "Adj. Close", "Adj. Volume",]]", I didn't put " df[[Adj. Open... " instead I had " [[Adj. Open ...".
      import pandas as pd
      import quandl
      df = quandl.get("WIKI/GOOGL")
      df = df[["Adj. Open", "Adj. High", "Adj. Low", "Adj. Close", "Adj. Volume",]]
      df["HL_PCT"] = (df["Adj. High"] - df["Adj. Low"])/df["Adj. Close"] * 100.0
      df["PCT_change"] = (df["Adj. Close"] - df["Adj. Open"])/df["Adj. Open"]* 100.0
      df = df[["Adj. Close", "HL_PCT", "PCT_change", "Adj. Volume",]]
      print(df.head())

    • @dannyisrael
      @dannyisrael 7 років тому

      I'm not sure what you changed and when I tried your code it didn't run. maybe because of the commas you have after your column selections. I don't know. But I definitely have the same error.
      Also, why are we using double brackets? [[ "column names" ]]
      "
      import pandas as pd
      import quandl
      df = quandl.get('WIKI/GOOGL')
      df = [['Adj. Open','Adj. High','Adj. Low','Adj. Close','Adj. Volume']]
      df['HL_PCT'] = (df['Adj. High'] - df['Adj. Close']) / df['Adj. Close'] *100
      df['PCT_change'] = (df['Adj. Close'] - df['Adj. Open']) / df['Adj. Open'] *100
      df = df[['Adj. Close','HL_PCT','PCT_change','Adj. Volume']]
      print(df.head())
      "

    • @alexvincent5626
      @alexvincent5626 7 років тому

      Thanks it worked for me!!

    • @fussballandy
      @fussballandy 5 років тому

      @@dermorgendanach93 thx bro

  • @Kalosb
    @Kalosb 4 роки тому +1

    ive not been able to load the 'WIKI/GOOGL' data set it keeps telling me:
    ' LimitExceededError: (Status 429) (Quandl Error QELx01) You have exceeded the anonymous user limit of 50 calls per day. To make more calls today, please register for a free Quandl account and then include your API key with your requests.
    '
    i even tried waiting for 24hrs, but the same result

    • @siddheshbalsaraf1776
      @siddheshbalsaraf1776 3 роки тому

      ok i get it now ..if u are having trouble downloading the dataset just use api key statement like this quandl.ApiConfig.api_key = "your api key after creating free acc " and then use quandl.get statement it works !

  • @ImperfectHestia
    @ImperfectHestia 4 роки тому +3

    "I really should be studying for finals"
    UA-cam: Let me recommend you this video =)

  • @khuyenle6972
    @khuyenle6972 4 роки тому +1

    It will be better if we pratice in an open source instead of using quandl.

  • @sonurony5171
    @sonurony5171 6 років тому +5

    Why did you use df[[]] instead of df[] when declaring df but not use df[['HL_PCT']].I know it is a multidimensional list .But why use it

    • @parveenk5710
      @parveenk5710 6 років тому +5

      If you want to access multiple columns use df[[]], here inner [] is the list of columns you want to access.

    • @braja5524
      @braja5524 5 років тому

      @@parveenk5710 thanks for the explanation!

  • @nadeemahmed7622
    @nadeemahmed7622 5 років тому +2

    Why high minus low percent is taken as high minus close divided by close and not high minus low divided by low?

    • @amandhakad2694
      @amandhakad2694 5 років тому

      typo mistake from his side, it will be (high-low)/low

  • @paliprashant
    @paliprashant 6 років тому +10

    Any alternative for quandl? No free data available for Stocks now.

    • @danic8897
      @danic8897 6 років тому +2

      Data is still available just use
      df = quandl.get('WIKI/GOOGL')

    • @jameswo4794
      @jameswo4794 6 років тому

      df = quandl.get('WIKI/GOOGL') doesn't work for me?

    • @mohamed_v1
      @mohamed_v1 6 років тому

      me too .. it's give me this Eroor "quandl.errors.quandl_error.LimitExceededError: (Status 429) (Quandl Error QELx01) You have exceeded the anonymous user limit of 50 calls per day. To make more calls today, please register for a free Quandl account and then include your API key with your requests.
      "

    • @mohamed_v1
      @mohamed_v1 6 років тому +2

      so try another database .. this one worked for me 'NSE/OIL'

    • @Dineshkumar-mh7gb
      @Dineshkumar-mh7gb 6 років тому +1

      Mohamed, the error you got is because you were using it without an account and you made more than 50 calls as sentdex explained..(hope this cleared it for someone)

  • @abrarmasumabir3809
    @abrarmasumabir3809 3 роки тому +1

    Can't find wiki google data set help..!

  • @springwaterfall8999
    @springwaterfall8999 Рік тому +3

    anyone where to get this dataset?

  • @leowang6470
    @leowang6470 Рік тому +1

    I pip installed Quandl but when I typed "df = Quandl('')", and it turns out that Quandl is undefined, why is that?

  • @autkarsh8830
    @autkarsh8830 6 років тому +9

    If anyone is getting keyError then use "Adj. Close" instead of "Adj.Close "(Use space)

    • @jayco10125
      @jayco10125 5 років тому

      thanks actual so helpful, idk where i went wrong until this

    • @taaaaby3
      @taaaaby3 5 років тому

      I got the same thing.

  • @phantomgaming1190
    @phantomgaming1190 5 місяців тому +1

    i think there is mistake in the column HL_PCT, you have by mistake taken adj_high - adj_close instead of adj_high - adj_low

  • @chandrarajanil3299
    @chandrarajanil3299 8 років тому +6

    on printing df.head() after modifying the data frame i am getting error as :
    AttributeError: 'list' object has no attribute 'head'

    • @lucasphillips2177
      @lucasphillips2177 4 роки тому

      are you sure you did df = pd.read_csv('filename')? If so, try without the parenthesis

    • @lucasphillips2177
      @lucasphillips2177 4 роки тому

      sorry i mean df = Quandl.get

    • @muhammadnoumanashraf2363
      @muhammadnoumanashraf2363 3 роки тому

      @@lucasphillips2177 i didnt find the data sets he uses can you share the link of data set

  • @JousefM
    @JousefM 5 років тому +1

    I opened a repository for everyone who wants to go through the code step-by-step with some small explanations :)
    github.com/jousefm/Machine-Learning-Sentdex
    Twitter: twitter.com/Jousefm2
    Instagram: instagram.com/jousefmrd/
    -----
    A sub would be great as well! Harrison motivated me to create me own Python series starting soon on my channel :)

  • @ThanhTran-pp5dd
    @ThanhTran-pp5dd 6 років тому +3

    for someone who did not show all columns, put: pd.set_option('display.max_rows', 500)
    pd.set_option('display.max_columns', 500)

    • @GoldDiggersTV
      @GoldDiggersTV 5 років тому

      when I paste following lines I get syntax error saying invalid character in identifier
      pd.set_option('display.max_rows', 500)
      pd.set_option('display.max_columns', 500)
      Am i doing something wrong? thanks

    • @dungotan4692
      @dungotan4692 5 років тому

      cảm ơn bạn nhé

    • @ThanhTran-pp5dd
      @ThanhTran-pp5dd 5 років тому

      @@GoldDiggersTV did you install or install right version? check all again

  • @dhairyabhatt3156
    @dhairyabhatt3156 5 років тому +1

    i have 3 colums in data shortVolume , shortexemptVolume,TotalVolume
    when i tried to get percentage of short this is error im getting
    Issue:
    df['pct_short'] = df['ShortVolume'] / df['TotalVloume'] * 100.0
    TypeError: list indices must be integers or slices, not str

  • @deepaksaharanymca
    @deepaksaharanymca 7 років тому +3

    I am trying to print the head after getting data from quandl. But do not know why ,but get api stucks and does not return. Please help

  • @surajharadagatti4411
    @surajharadagatti4411 5 років тому +1

    for folks having trouble, you'll need to create an account on quandl to use the data. Once you create an account you get apikey. Run this command before importing data quandl.ApiConfig.api_key = "YOURAPIKEY"

  • @jamesgeorge5698
    @jamesgeorge5698 7 років тому +3

    Can you describe regression in a simple way and also what you did in this tutorial?
    Is it just simple data collection?

    • @hellriders1907
      @hellriders1907 4 роки тому

      Bro if u learned plz teach me. I didnt understand anything. Wtf are they Man

  • @FabledNarrative
    @FabledNarrative 6 років тому +2

    For those getting the error of need to use an API_Key for use...
    quandl.ApiConfig.api_key = 'you_api_key_from_quandl'

    • @tariqhassan3194
      @tariqhassan3194 5 років тому

      How do I get my API_Key I already registered. Please share your code. thanks

  • @ziis8285
    @ziis8285 5 років тому +8

    i think i am too stupid for this .....

    • @ajinkya3780
      @ajinkya3780 4 роки тому

      @Neil Lunavat Pour some hot coffee on your computer.. Issue resolved

  • @Indraw705
    @Indraw705 7 років тому +2

    I used NSE:YESBANK with authtoken
    It is giving me error like
    File "C:\Python27\lib\site-packages\pandas\core\indexing.py", line 1230, in _convert_to_indexer
    raise KeyError('%s not in index' % objarr[mask])
    KeyError: "['Adj. Open' 'Adj. High' 'Adj. Low' 'Adj. Close' 'Adj. Volume'] not in index"

    • @varunjoshi3619
      @varunjoshi3619 7 років тому

      Getting the same issue.How did u solve it?

  • @mr.nobody6392
    @mr.nobody6392 8 років тому +3

    Ohhh... Wow You Finally Installed Windows 10..!!!! :)

  • @flow2061
    @flow2061 5 місяців тому +1

    HL column should be (high-low)/low * 100 right?

  • @reevanthlama5278
    @reevanthlama5278 7 років тому +3

    You got the data set for 2004 ... How would i get the latest data set as of now i want to get the data set for 2016

    • @petersmiley9979
      @petersmiley9979 6 років тому +1

      at the top of the console it is 2004, if you scroll to the bottom, it is the current date. Sorry for the 10 months late :)

    • @petersmiley9979
      @petersmiley9979 6 років тому

      oh and also get rid of df.head() and write df.head instead, not sure why it works but it does

  • @simanchalpatnaik2566
    @simanchalpatnaik2566 5 років тому +1

    Hello buddy...Awesome video..
    I have python 3.6 installed & PIP 19.0.2
    Could you please share the link to install sklearn, quandl & pandas...Thank you

    • @kushagrak960
      @kushagrak960 5 років тому

      Bhai please please help me how to install these.

    • @kushagrak960
      @kushagrak960 5 років тому

      @@dumbstuff2809 should I turn on my internet while for this?

  • @g_pazzini
    @g_pazzini 7 років тому +3

    you also need to pip install NumPy and pip install SciPy first.

  • @usernameutuber3466
    @usernameutuber3466 7 років тому +1

    Hi Guys, in regards to the Quandl module problem I think it is much easier to use Conda:
    1- Install Anaconda. (search how- very easy)
    2- use conda install quandl.
    3- on my device I used (import Quandl) and it worked.
    And Thank you Harrison all the best... :)

  • @kareygraham9728
    @kareygraham9728 8 років тому +3

    Thank you for the excellent series, man. Truly doing some great work here.

  • @yusufawad6779
    @yusufawad6779 7 років тому +2

    I did install every thing and I get on Mac Please help
    RESTART: /Users/mac/Documents/python/Untitled.py ==============
    Traceback (most recent call last):
    File "/Users/mac/Documents/python/Untitled.py", line 1, in
    import pandas
    ModuleNotFoundError: No module named 'pandas'

    • @StormEntertainmentTV
      @StormEntertainmentTV 7 років тому

      Make sure that you are running sudo pip3 install pandas OR sudo pip install pandas (if you are using python 2.7)

    • @hienn.2918
      @hienn.2918 7 років тому

      Dont know if you have figured out the solution yet. But if you are using a Mac, I recommend installing Anaconda distribution. It makes everything much easier.

  • @sidixofficial
    @sidixofficial 5 років тому +1

    guys , I have LimitExceededError, could you please send a download file, so I won't get that error, thanks

  • @ashwin372
    @ashwin372 6 років тому +5

    can you add some q&a session with lot of noob questions?
    my question i am in love with maths and programming and the concept of machine learning overwhelms me but i dont know where to start or what path to follow

    • @zombiesalad2722
      @zombiesalad2722 3 роки тому

      what path did you follow? I'm in the same boat

  • @gentianamorina1848
    @gentianamorina1848 7 років тому +2

    KeyError: “['blah'] not in index”
    Just change the attribute name to the correct one.
    Type print(df.head()) and you can see the correct names.
    You're welcome :)

  • @TheXimelitt
    @TheXimelitt 7 років тому +15

    Hi, I don't speak english very well and yesterday I wached your tutorial of basic python just those 30 first . My question: why did you use two brackets in def =def[[]] ? Please :'D

    • @tongbogeng7348
      @tongbogeng7348 7 років тому +4

      this means a matrix in Python. There are several columns in this Data Frame(df), it's a 2-dimensional matrix.

    • @jameslay6505
      @jameslay6505 6 років тому +12

      If you're wondering how the `df[[ ... ]]` syntax works mechanically, it's overloading __getitem__ for pandas.DataFrame. In other words, Pandas uses "operator overloading" to allow the brackets to be used in new ways. You can overload the accessor (brackets) on your own classes by giving them a __getitem__ method. Another way to view this is that `df[ ["a", "b" ] ]` is the same as `df.__getitem__(["a","b"])`. Hopefully that wasn't too confusing. For more info, check out operator overloading in Python. thepythonguru.com/python-operator-overloading/

    • @ApenasVinny
      @ApenasVinny 6 років тому

      Thank You James !!

    • @jaarsi
      @jaarsi 6 років тому

      i thought the same ! in python, u cant have mutable data as key dict. what he does, can only be achieved overloading the "__getitem__" method;

  • @bear9954
    @bear9954 7 років тому +1

    Whenever I try installing sci-kit learn I just get an error. I can install other modules bot not that one please help

  • @janekmuric
    @janekmuric 8 років тому +3

    Aaargh! Can't wait for more tutorials.

  • @mnomeli
    @mnomeli 8 років тому +2

    For those of you who have issues with importing Quandl try the following : Have only one interpreter installed on your machine (let's say Anaconda) and use lowercase 'q' (quandl). Hope it helps! Good luck!

    • @sentdex
      @sentdex  8 років тому +1

      Anyone with the latest version of Quandl will have this issue. Somewhere since I did these videos, they changed it. Jerks :P

  • @WillStewart2014
    @WillStewart2014 5 років тому +3

    Is there anyway you could update this content? I'm only 3 minutes in and everything is different now.

  • @AdityaMishra-mz2rk
    @AdityaMishra-mz2rk 3 роки тому +1

    I can't find the dataset that you used probably because it's 5 years old , so can anyone help me?

  • @vishalvatsalya1439
    @vishalvatsalya1439 7 років тому +5

    "TypeError: list indices must be integers or slices, not str"
    Error is being shown to me,
    please help!

    • @dannyisrael
      @dannyisrael 7 років тому +2

      me too....

    • @pydataco
      @pydataco 7 років тому

      which location of the video did you get this error?

    • @kenk7049
      @kenk7049 6 років тому

      df = df[['Adj. Close','HL_PCT','PCT_change','Adj. Volume']]
      Did you type the above correctly?

    • @BrettClimb
      @BrettClimb 6 років тому

      I got this error when I forgot to type df before the brackets on the right side of the assignment statement: df = df[[...]]

  • @tcg5680
    @tcg5680 5 років тому +1

    Can you please redo this video a lot has changed apparently and I get soooo many errors from the beginning of the tutorial

  • @KimaniWaNdirangu
    @KimaniWaNdirangu 8 років тому +8

    Thanks for these ML tutorials. Anaconda Python from Continuum Analytics has all popular Python libraries - SciKit, pandas, NumPy, SciPy...etc

    • @rahul_bali
      @rahul_bali 8 років тому +4

      +Kimani Wa Ndirangu This is the most important piece of tutorial which must be told. Installing packages one by one takes forever.
      Also, not to forget about the installation errors.

    • @Vishnu.Suresh
      @Vishnu.Suresh 6 років тому +1

      Just to add : Latest Anaconda doesnt have quandl so that needs to be installed to the Anaconda package list. CHeers!

  • @RavingPain
    @RavingPain 4 роки тому +1

    You are writing all these commands in the default python IDE but can I also execute them in PyCharm? I installed all the pip modules after a lot of effort due to errors.

    • @sentdex
      @sentdex  4 роки тому

      Yes you can use pycharm

    • @RavingPain
      @RavingPain 4 роки тому

      @@sentdex Thank you. I plan to try and learn ml on my own because I think it's very interesting and your tutorials help a lot.

  • @afayirmotonshil1689
    @afayirmotonshil1689 5 років тому

    Can't fetch data from 'WIKI/GOOGL'
    Following error shown:
    ------------------------------------
    Exception has occurred: QuandlError
    (Status 403) Something went wrong. Please try again. If you continue to have problems, please contact us at connect@quandl.com.

  • @skyler114
    @skyler114 5 років тому +1

    download this google stock dataset: www.kaggle.com/gunhee/amdgoogle/version/3
    replace the quandl with this:
    df = pd.read_csv('GOOGL.csv')
    you'll ahve to work with unadjusted values though

    • @Alan_christo
      @Alan_christo 5 років тому

      why the output is looking different from that in the video . will i be able to follow him? thanks :)

    • @Alan_christo
      @Alan_christo 5 років тому

      not working , any idea why?

    • @skyler114
      @skyler114 5 років тому

      @@Alan_christo the dataset he had uses adjusted values so the columns he has say "adj. Close " and the like. This one just has the regular so you use "Close". Just drop adj. Everywhere he uses it

  • @uriel4829
    @uriel4829 4 роки тому +1

    If youre getting a 'ModuleNotFoundError: No module named 'Quandl'' error try importing quandl (no capital) :)

  • @brianko4285
    @brianko4285 7 років тому +1

    df = df[['Adj. Open', 'Adj. High', 'Adj. Low', 'Adj. Close', 'Adj. Volume']] is this syntax specific to quandl? Or pandas?

  • @EzioOmer
    @EzioOmer 5 років тому

    if any of you guys having this error (list indices must be integers or slices, not str) make sure you didnt type this like me .
    The Wrong ONE !!
    df = [['Adj. Open','Adj. High','Adj. Low','Adj. Close','Adj. Volume']]
    The True ONE!
    df = df[['Adj. Open','Adj. High','Adj. Low','Adj. Close','Adj. Volume']]

  • @pavankumark4708
    @pavankumark4708 7 років тому

    i have written the same code and run it. it shows the following errors
    -------------------------------------------------------------------------------------------------------------
    C:\Python27\python.exe "C:/Users/pavan kumar kota/PycharmProjects/python learning programs/machine learning/mc1.py"
    Traceback (most recent call last):
    File "C:/Users/pavan kumar kota/PycharmProjects/python learning programs/machine learning/mc1.py", line 2, in
    import quandl
    File "C:\Python27\lib\site-packages\quandl\__init__.py", line 7, in
    from .model.database import Database
    File "C:\Python27\lib\site-packages\quandl\model\database.py", line 18, in
    import quandl.model.dataset
    File "C:\Python27\lib\site-packages\quandl\model\dataset.py", line 5, in
    from .data import Data
    File "C:\Python27\lib\site-packages\quandl\model\data.py", line 1, in
    from quandl.operations.data_list import DataListOperation
    File "C:\Python27\lib\site-packages\quandl\operations\data_list.py", line 1, in
    from quandl.model.data_list import DataList
    File "C:\Python27\lib\site-packages\quandl\model\data_list.py", line 2, in
    from .data_mixin import DataMixin
    File "C:\Python27\lib\site-packages\quandl\model\data_mixin.py", line 1, in
    import pandas as pd
    File "C:\Python27\lib\site-packages\pandas\__init__.py", line 26, in
    from pandas._libs import (hashtable as _hashtable,
    File "C:\Python27\lib\site-packages\pandas\_libs\__init__.py", line 3, in
    from .tslib import iNaT, NaT, Timestamp, Timedelta, OutOfBoundsDatetime
    File "pandas\_libs\src
    umpy.pxd", line 157, in init pandas._libs.tslib (pandas\_libs\tslib.c:117317)
    ValueError: numpy.dtype has the wrong size, try recompiling. Expected 52, got 56
    Process finished with exit code 1

  • @dlfmal123
    @dlfmal123 5 років тому

    how to solve the below code? I got a error message.
    with 'DeprecationWarning: Function make_blobs is deprecated; Please import make_blobs directly from scikit-learn
    warnings.warn(msg, category=DeprecationWarning)'
    from IPython.display import display
    import pandas as pd
    import mglearn
    import numpy as np
    import scipy as sp
    import matplotlib.pyplot as plt
    # 데이터셋을 만듭니다
    X, y = mglearn.datasets.make_forge()
    # 산점도를 그립니다
    mglearn.discrete_scatter(X[:, 0], X[:, 1], y)
    plt.legend(["클래스 0", "클래스 1"], loc=4)
    plt.xlabel("첫 번째 특성")
    plt.ylabel("두 번째 특성")
    print("X.shape: {}".format(X.shape))
    print("mglearn version: {}".format(mglearn.__version__))
    X, y = mglearn.datasets.make_wave(n_samples=40)
    plt.plot(X, y, 'o')
    plt.ylim(-3, 3)
    plt.xlabel("특성")
    plt.ylabel("타깃")

  • @alexschweich6347
    @alexschweich6347 6 років тому

    In case anyone watching this video is stuck, here is my code that works with Python 3.7.0:
    import pandas as pd
    import quandl
    #Gets the data from Quandl about the history of GOOGL from 8/19/2004 - 8/25/2004
    df = quandl.get("WIKI/GOOGL", authtoken="", start_date="2004-08-19",
    end_date="2004-08-25")
    #Edits the Dataframe(DF) to include the columns from the dataset
    df = df[["Adj. Open","Adj. High","Adj. Low","Adj. Close","Adj. Volume",]]
    #Creates two new columns showing: Change in the high/low and change in the open/close
    df["HL_PCT"] = (df["Adj. High"] - df["Adj. Low"]) / df["Adj. Low"] * 100.0
    df["CHANGE_PCT"] = (df["Adj. Close"] - df["Adj. Open"]) / df["Adj. Open"] * 100.0
    #Changes DF again to show only the columns we want to see, then prints it
    df = df[["Adj. High","Adj. Low","HL_PCT","Adj. Open","Adj. Close","CHANGE_PCT",]]
    print(df.head())
    You need to create a Quandl account now and include your authtoken in your get() request. I changed a couple things that I thought made it show the data a little better but this works. Hope this helps.

  • @DJ95
    @DJ95 4 роки тому +1

    hello everyone :)
    anybody knows if the whole tutorial "Machine Learning with Python" from our amazing Sentdex is still valid in 2020 (end of the August 2020 to be specific) ?
    thaaaaanks

    • @turalto9324
      @turalto9324 4 роки тому

      That's why I am here (srry for bad english)

  • @philinnc
    @philinnc 5 років тому

    To avoid "limit exceeded" messages when using quandl, I broke down and signed up for a free account to get my own api key. You can call this out in your code with the directive:
    ```
    import quandl
    quandl.ApiConfig,api_key = "xxxxxxxxx"
    ```
    If you store it as an os environment variable (say, QUANDL_API_KEY), you won't have to put your key in every script. Instead, just add the lines:
    ```
    import os
    import quandl
    quandl.ApiConfig.api_key = os.environ['QUANDL_API_KEY']
    ```
    On Linux or Mac, you can add the following line to your .profile (or .bash_profile, depending on your distro):
    ```
    export QUANDL_API_KEY="xxxxxxxxx"
    ```
    On Windows you'll need to open "Advanced System Settings" and click "Environment Variables" to add a new User variable for your Windows user.

  • @nvnvashisth
    @nvnvashisth 7 років тому

    I have install python and necessary package in Ubuntu 17.04
    My code as below:
    import pandas as pd
    import quandl
    df = quandl.get('WIKI/GOOGL')
    print(df.head())
    Error below:
    :~/Documents/Python$ ./ML1.py
    import-im6.q16: unable to open image `pd': Permission denied @ error/blob.c/OpenBlob/2701.
    ./ML1.py: line 4: syntax error near unexpected token `('
    ./ML1.py: line 4: `df = quandl.get('WIKI/GOOGL')
    As soon as run the program, my cursor turn into snipping tool cursor. Any clue on this?