Giter Club home page Giter Club logo

Comments (4)

tsawczuk avatar tsawczuk commented on September 24, 2024

I got the same issue this morning when scraping 28/11/2020 gb results, but not when scraping 2/12/2020 gb results. Looking at the csv, the error seems to happen at approximately the 2.25 Newbury, which appears to have a database bug. If you check the result of that race, there are a number of horses which have '&' as their name so it seems to be an issue on RP's side annoyingly (but if there's a way round on our side that would be great).

from rpscrape.

durkinliam avatar durkinliam commented on September 24, 2024

Python's not my language, I'm only using this to scrape and export the csv to use in R, so this may not be the correct approach - however it seems to have worked.

On a branch, I've changed the fraction_to_decimal function. It now has or fraction == '&' after the no odds statement.

def fraction_to_decimal(fractions):
    decimal = []
    for fraction in fractions:
        if fraction == '' or fraction == 'No Odds' or fraction == '&':
            decimal.append('')
        elif 'evens' in fraction.lower() or fraction.lower() == 'evs':
            decimal.append('2.00')
        else:
            decimal.append('{0:.2f}'.format(float(fraction.split('/')[0]) / float(fraction.split('/')[1]) + 1.00))

    return decimal

from rpscrape.

tsawczuk avatar tsawczuk commented on September 24, 2024

Yep, I've just checked this on the aforementioned 28/11/20 data and it works a treat. I was expecting to have a bunch of horses with '&' as their name, but having checked the csv file that doesn't happen. It seems to just skip those horses where the errors have occurred. Thanks for uploading your changes.

from rpscrape.

joenano avatar joenano commented on September 24, 2024

Assuming this was a one off edge case and fixed.

from rpscrape.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.