-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Keyerror for getattr(stage, classification) #14
Comments
It's fixed, however I had to remove riders that didn't finished stage from TTT results, because it's not possible to get additional info about them (age, nationality...) from the GC and almost all of their stage specific fields would be unknown (time, points, bonus...). I hope that it won't be a problem, since it's still possible to parse startlist/the stage before if you want and see which riders are missing after the TTT. The new version will be soon available on PyPI. |
🤟🏻
Met vriendelijke groet,
Hidde Reitsma
advocaat
AMS Advocaten N.V.<http://www.amsadvocaten.nl/>
Poeldijkstraat 4
Postbus 69111
1060 CD Amsterdam
T: +31 20 3080 315<tel:+31%2020%203080%20315>
F: +31 20 3080 325<tel:+31%2020%203080%20325>
Vestiging Naarden:
IJsselmeerweg 100A
T: +31 35 302 0015<tel:+31%2035%20302%200015>
F: +31 35 302 0025<tel:+31%2035%20302%200025>
Verzonden vanaf een mobiel apparaat. Typo’s voorbehouden. AMS Advocaten N.V. (“AMS”) is een naamloze vennootschap, ingeschreven in het handelsregister onder nummer 53039734. Op alle door AMS verleende diensten zijn uitsluitend haar algemene voorwaarden van toepassing. Deze voorwaarden zijn onder voormeld nummer gedeponeerd bij het handelsregister, kunnen worden gedownload van https://www.amsadvocaten.nl/algemene-voorwaarden/ en worden op verzoek kosteloos verstrekt. De voorwaarden bevatten een beperking van aansprakelijkheid tot het bedrag dat in het betreffende geval onder de beroepsaansprakelijkheidsverzekering van AMS wordt uitgekeerd. AMS verwerkt persoonsgegevens, in overeenstemming met haar privacy policy: https://www.amsadvocaten.nl/privacy-policy/.
Sent from a mobile device. Typographical errors reserved. AMS Advocaten N.V. (“AMS”) is a limited liability company under Dutch law, registered at the Dutch Commercial Register under number 53039734. All services provided by AMS are subject (exclusively) to its general terms and conditions. These terms have been filed with the Commercial Register, can be downloaded at https://www.amsadvocaten.com/general-terms-conditions/ and will be provided free of charge upon request. These terms contain a limitation of liability to the sum as is paid out in the matter concerned under the professional liability insurance of AMS. AMS processes personal data in accordance with its privacy policy: https://www.amsadvocaten.com/privacy-policy/.
…________________________________
Van: Martin Madzin ***@***.***>
Verzonden: Monday, August 28, 2023 11:49:03 AM
Aan: themm1/procyclingstats ***@***.***>
CC: Hidde Reitsma ***@***.***>; Author ***@***.***>
Onderwerp: Re: [themm1/procyclingstats] Keyerror for getattr(stage, classification) (Issue #14)
It's fixed, however I had to remove riders that didn't finished stage from TTT results, because it's not possible to get additional info about them (age, nationality...) from the GC and almost all of their stage specific fields would be unknown (time, points, bonus...). I hope that it won't be a problem, since it's still possible to parse startlist/the stage before if you want and see which riders are missing after the TTT. The new version will be soon available on PyPI.
—
Reply to this email directly, view it on GitHub<#14 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/A4RCLSAUAC2NB4CF6QWMS7LXXRSQ7ANCNFSM6AAAAAA4A6WX4Y>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Mmm, I still get the Laurens de Plus(ki) KeyError: Traceback (most recent call last): |
or should I wait for an update in pip? |
Well I don't know what is the exact URL where you get the error but on this URL: https://www.procyclingstats.com/race/vuelta-a-espana/2023/stage-1 everything works fine in latest PyPI version. (I published version 0.1.7 on PyPI today so make sure that you have upgraded) |
Thx. I updated, now the error seems no more related to the pcs code. guess it has to do with S01 being a TTT; the code tries to get columns expected in "normal" stage results but now unavailable. The stage type (TTT, etc) is not in the dataframe of the stages, right? Any suggestion how to filter this out with an if/else? |
It should return the same table as normal stage, but now I see that rider_number field is missing in TTT results. I will try to fix this soon. All other normal results fields are present in TTT results table. |
Thx. I am unsure if it is the TTT thing - riders are not in these results anyway, although I try to create columns rider_name and rider_number in my data. Anyway, I get this trackback, also when I skip scraping stage 1 (the part of the code can copied below): (NB: my code generally genrerates CSV's, to be merged to an xlsx in the end, with all relevant results, being startlist, all stage results, and all classfications after each stage) Traceback (most recent call last): code: loop1 - loop to create CSV's for results and classifications of each stage
|
One more thing: I added a debug print line, for data = getattr(stage, classification); print(f"Data for {classification}: {data}") gives: Data for results: <bound method Stage.results of Stage(url='https://www.procyclingstats.com/race/vuelta-a-espana/2023/stage-1')> so the wrong data for results seems to be scraped, right? |
The mentioned error is caused because of this line on the page from where you are parsing results from: https://www.procyclingstats.com/race/vuelta-a-espana/2023/stage-2 I can not do much about it, because the problem is in the PCS results page. I think that they will fix the times soon. |
Ah! Yest, that's it |
Well I don't really understand what does the "-1:0-1:0" mean. But I think it's weird that they are listing the times from 9k in the results from finish even if that counts to the GC. It would made more sense to just use the real finish line times in the stage results. If the results won't change in a few days I will have to try to deal with that time notations however. |
line data = getattr(stage, classification)() gives error in the pcs code it seems:
File "C:\Users%username%\AppData\Local\Programs\Python\Python311\Lib\site-packages\procyclingstats\stage_scraper.py", line 298, in results
table = join_tables(table, table_parser.table, "rider_url")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users%username%\AppData\Local\Programs\Python\Python311\Lib\site-packages\procyclingstats\utils.py", line 162, in join_tables
table.append({**table2_dict[row[join_key]], **row})
~~~~~~~~~~~^^^^^^^^^^^^^^^
KeyError: 'rider/laurens-de-plus'
The text was updated successfully, but these errors were encountered: