Open asinofsky opened 2 years ago
If I delete the data and rerun it, it seems to work, so I think it's only when there was existing fighter data etc. it was trying to use.
Hi,
Are you using windows?
Sam
On Wed, Mar 2, 2022 at 4:08 PM ojneto @.***> wrote:
Hello. I didn't understand how to use how to run the command "python -m src.create_ufc_data". Can you explain me?
— Reply to this email directly, view it on GitHub https://github.com/WarrierRajeev/UFC-Predictions/issues/21#issuecomment-1057444148, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADGY6ZD3XU23YP2ZWUDACDDU57RGDANCNFSM5PPFMGKA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
You are receiving this because you authored the thread.Message ID: @.***>
Yes, I'm using windows. I managed to run the command. However, the following error appears:
Creating fight data
Scraping links! Scraping event and fight links: Progress: |██████████████████████████████████████████████████| 100.00% Complete Successfully scraped and saved event and fight links!
Now, scraping event and fight data!
TypeError Traceback (most recent call last)
Oof, yeah sorry I don't know python enough nor the script to help you with that error :(. My only advice would be to delete all the intermediate files, and try again.
On Wed, Mar 2, 2022 at 5:34 PM ojneto @.***> wrote:
Yes, I'm using windows. I managed to run the command. However, the following error appears:
Creating fight data
Scraping links! Scraping event and fight links: Progress: |██████████████████████████████████████████████████| 100.00% Complete Successfully scraped and saved event and fight links!
Now, scraping event and fight data! Scraping data for 595 fights: Progress: |--------------------------------------------------| 0.00% Complete
TypeError Traceback (most recent call last) in 2 print("Creating fight data \n") 3 fight_data_scraper = FightDataScraper() ----> 4 fight_data_scraper.create_fight_data_csv() # Scrapes raw ufc fight data from website 5 print(f'elapsed seconds = {(time.time() - time_start):.2f}')
~\Documents\UFC-Predictions-master\UFC-Predictions-master\src\createdata\scrape_fight_data.py in create_fight_data_csv(self) 43 self._scrape_raw_fight_data( 44 all_events_and_fight_links, ---> 45 filepath=self.TOTAL_EVENT_AND_FIGHTS_PATH, 46 ) 47 else:
~\Documents\UFC-Predictions-master\UFC-Predictions-master\src\createdata\scrape_fight_data.py in _scrape_raw_fight_data(self, event_and_fight_links, filepath) 77 print(f'File {filepath} already exists, overwriting.') 78 ---> 79 total_stats = FightDataScraper._get_total_fight_stats(event_and_fight_links) 80 with open(filepath.as_posix(), "wb") as file: 81 file.write(bytes(self.HEADER, encoding="ascii", errors="ignore"))
~\Documents\UFC-Predictions-master\UFC-Predictions-master\src\createdata\scrape_fight_data.py in _get_total_fight_stats(cls, event_and_fight_links) 121 futures = [] 122 for fight in fights: --> 123 futures.append(executor.submit(FightDataScraper._get_fight_stats_task, self=cls, fight=fight, event_info=event_info)) 124 for future in concurrent.futures.as_completed(futures): 125 fighter_stats = future.result()
TypeError: submit() got multiple values for argument 'self'
— Reply to this email directly, view it on GitHub https://github.com/WarrierRajeev/UFC-Predictions/issues/21#issuecomment-1057496949, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADGY6ZH4KJPF4M626C3RRYTU573HNANCNFSM5PPFMGKA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
You are receiving this because you authored the thread.Message ID: @.***>
I thank your attention. Could you briefly describe how you managed to get the updated data?
All I did was download the folder from github, go to the folder, open the cmd window by typing "cmd" and then copy pasted the function into it and pressed enter. It looked just like yours, but then it succeeded instead of having that error.
On Wed, Mar 2, 2022 at 6:07 PM ojneto @.***> wrote:
I thank your attention. Could you briefly describe how you managed to get the updated data?
— Reply to this email directly, view it on GitHub https://github.com/WarrierRajeev/UFC-Predictions/issues/21#issuecomment-1057524857, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADGY6ZCV6JJEC5JWHQP7SA3U577EXANCNFSM5PPFMGKA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
You are receiving this because you authored the thread.Message ID: @.***>
I keep trying. Thank you for your help.
Hi,
I'm new to github and python, I tried to run
python -m src.create_ufc_data
from the root folder to scrape fresh data last week, and it worked successfully, but when I tried this week, it seems to scrape everything successfully but then when processing I get this error:
'float' object has no attribute 'split'
Here is more detail:
Getting fighter urls
Getting fighter names and details
Scraping all fighter names and links: Progress: |██████████████████████████████████████████████████| 100.00% Complete No new fighter data to scrape at the moment, loaded existing data from C:\Users\...\UFC-Predictions-master\data\fighter_details.csv.
elapsed seconds = 19.22
Starting Preprocessing
Reading Files Drop columns that contain information not yet occurred Renaming Columns Traceback (most recent call last): File "C:\Users\\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Users\\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
File "C:\Users\\Documents\repos\mma\UFC-Predictions-master\src\create_ufc_data.py", line 21, in
preprocessor.process_raw_data() # Preprocesses the raw data and saves the csv files in data folder
File "C:\Users\\Documents\repos\mma\UFC-Predictions-master\src\createdata\preprocess.py", line 34, in process_raw_data
self._rename_columns()
File "C:\Users\\Documents\repos\mma\UFC-Predictions-master\src\createdata\preprocess.py", line 115, in _rename_columns
self.fights[column + attempt_suffix] = self.fights[column].apply(
File "C:\Users\\AppData\Local\Programs\Python\Python310\lib\site-packages\pandas\core\series.py", line 4430, in apply
return SeriesApply(self, func, convert_dtype, args, kwargs).apply()
File "C:\Users\\AppData\Local\Programs\Python\Python310\lib\site-packages\pandas\core\apply.py", line 1082, in apply
return self.apply_standard()
File "C:\Users\\AppData\Local\Programs\Python\Python310\lib\site-packages\pandas\core\apply.py", line 1137, in apply_standard
mapped = lib.map_infer(
File "pandas_libs\lib.pyx", line 2870, in pandas._libs.lib.map_infer
File "C:\Users\\Documents\repos\mma\UFC-Predictions-master\src\createdata\preprocess.py", line 116, in
lambda X: int(X.split("of")[1])
AttributeError: 'float' object has no attribute 'split'