1. #36
    Waterstpub87
    Slan go foill
    Waterstpub87's Avatar Become A Pro!
    Join Date: 09-09-09
    Posts: 4,044
    Betpoints: 7292

    Quote Originally Posted by gauchojake View Post
    Success!! I had to remove two lines of code but got the script to run. It's a little messy but I spot checked the data and it looks good. Thank you sir.
    Really glad to hear it. I hope it helps out with college basketball as well as learning python. It is a pretty easy language once you get the hang of it. Just learn to google everything. Like "How do I remove a column python" and you will get the answer in seconds.

    Which two lines did you remove out of curiosity? If the data looks messy that might be why.

    Will be doing some college football work during the spring. Might post a similar code for getting a play by play college football database.

  2. #37
    gauchojake
    Have Some Asthma
    gauchojake's Avatar SBR PRO
    Join Date: 09-17-10
    Posts: 33,726
    Betpoints: 13300

    I kept getting errors on the following

    C:\Users\jake\.spyder-py3\untitled6.py:45: SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrameSee the caveats in the documentation: https://pandas.pydata.org/pandas-doc...-versus-a-copy scl.loc['Louisiana']['URL']='louisiana-lafayette'C:\Users\jake\.spyder-py3\untitled6.py:46: SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrameSee the caveats in the documentation: https://pandas.pydata.org/pandas-doc...-versus-a-copy scl.loc['VMI']['URL']='virginia-military-institute'Traceback (most recent call last):

    The two lines of code didn't really match the rest of the format so just to experiment I pulled them out and ran it and it worked.

    I ran 2021 and it came back cleaner than 2020 and 2019. I think what's happening is that because the previous seasons have more games that there are page breaks. The column stats headers just keep getting inserted. Easy to clean up.

  3. #38
    Waterstpub87
    Slan go foill
    Waterstpub87's Avatar Become A Pro!
    Join Date: 09-09-09
    Posts: 4,044
    Betpoints: 7292

    Quote Originally Posted by gauchojake View Post
    I kept getting errors on the following

    C:\Users\jake\.spyder-py3\untitled6.py:45: SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrameSee the caveats in the documentation: https://pandas.pydata.org/pandas-doc...-versus-a-copy scl.loc['Louisiana']['URL']='louisiana-lafayette'C:\Users\jake\.spyder-py3\untitled6.py:46: SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrameSee the caveats in the documentation: https://pandas.pydata.org/pandas-doc...-versus-a-copy scl.loc['VMI']['URL']='virginia-military-institute'Traceback (most recent call last):

    The two lines of code didn't really match the rest of the format so just to experiment I pulled them out and ran it and it worked.

    I ran 2021 and it came back cleaner than 2020 and 2019. I think what's happening is that because the previous seasons have more games that there are page breaks. The column stats headers just keep getting inserted. Easy to clean up.
    Warnings, not errors. Errors mean the code stops running. Those are warnings, indicating that python, in this case pandas, does not like something you are doing.
    It doesn't like when you do things like that. You are basically pulling a row of the table (.loc) and then a column of that row and changing it. I wrote this prior to being more experienced with python, and I never felt it was worth the effort to fix. If you adjusted those, just make sure you have the actual data of the school in the database. That section change the URLs to match the format of the webpage.
    There is a lot of formatting of the data. Most of the lines are formatting the data. College basketball reference, god knows why, changes some of the names of the school when they are the opponent. For example, it might be Virginia Military Institute as the page URL and the school in its own table, and then VMI in the opponents table. Which makes it annoying as hell when you are trying to do like a strength of schedule type thing.
    Last edited by Waterstpub87; 12-23-20 at 10:33 PM.

  4. #39
    gauchojake
    Have Some Asthma
    gauchojake's Avatar SBR PRO
    Join Date: 09-17-10
    Posts: 33,726
    Betpoints: 13300

    I put the code back in and ran it again. Looks almost the same. Either way it's working so I am super stoked.

    Thanks for doing this. Appreciate it!

  5. #40
    Waterstpub87
    Slan go foill
    Waterstpub87's Avatar Become A Pro!
    Join Date: 09-09-09
    Posts: 4,044
    Betpoints: 7292

    Quote Originally Posted by gauchojake View Post
    I put the code back in and ran it again. Looks almost the same. Either way it's working so I am super stoked.

    Thanks for doing this. Appreciate it!


    Plan to work on a few projects in the new year, an sbr odds scraper as well as a college football play by play database. Will post both here when finished.

First 12
Top