Python Forum
problem with a formula 1 kind of homework
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
problem with a formula 1 kind of homework
#3
(Jun-17-2023, 02:19 PM)deanhystad Wrote: I am not seeing the error you describe. I get a TypeError when getting the session. The error cleared up when I changed line 28 to:
race_data = fastf1.get_session(2023, 1, "Race")
After you get a session, you need to load the session data. This loads the data into DataFrames, so there is no reason to create them yourself.
race_data = fastf1.get_session(2023, 1, "Race")
race_data.load()
# Load the lap data
df = pd.DataFrame(race_data.laps[["Time", "Compound"]])
race_data.laps is a dataframe of lap data. df is the same data, but only for two columns (Time and Compound).

What version of fastf1 are you using? Almost none of your code is correct for the most recent version (3.0.4). Looking at the release notes it looks like you are using something pre-3.0. I suggest you get the newest version.

to be frank i am really new to this kind of stuff and i am using chatgpt/bard to execute the ideas i have in mind. i also do not get the concept of dataframes (the way they work) so i will try to get more informations on these matters and then i will try to update my code.
after few attempts and after making the changes you told me to make, i get this new error message:
Error:
Traceback (most recent call last): File "<tmp 11>", line 36, in <module> race_data.load() AttributeError: 'Weekend' object has no attribute 'load'
when i replace it with:
laps=race_data.load_laps()

i get the following error message
Error:
Traceback (most recent call last): File "<tmp 12>", line 47, in <module> laps = race_data.load_laps() File "c:\users\windownet\appdata\local\programs\python\python311\Lib\site-packages\fastf1\core.py", line 1234, in load_laps if any((laps, telemetry, weather, messages)): File "c:\users\windownet\appdata\local\programs\python\python311\Lib\site-packages\fastf1\core.py", line 1311, in load_telemetry result['New'] = False TypeError: DataFrame.drop() takes from 1 to 2 positional arguments but 3 were given
by the way i checked and i found that i have the latest version of the package. the abnormalitites are certainly due to the fact that chatgpt uses an older version of the package and since i told it to fix the code before i came to the forum it appears that it worked with some older version
thanks in advance for taking time to help me.
buran write Jun-20-2023, 04:51 PM:
Please, use proper tags when post code, traceback, output, etc.
See BBcode help for more info.
Reply


Messages In This Thread
RE: problem with a formula 1 kind of homework - by claroque - Jun-20-2023, 09:58 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Bakery Problem.. Can you Help My Homework Cemvrs 1 2,394 Jan-14-2022, 05:47 PM
Last Post: Yoriz
  Can someone find out what kind of histogram is it? J_tin 1 1,826 Apr-26-2020, 05:23 PM
Last Post: buran
  Need help with a homework problem on logical operators voodoo 3 4,615 Jun-28-2019, 03:45 PM
Last Post: jefsummers
  Homework Problem csascott 1 2,296 Oct-27-2018, 04:44 AM
Last Post: scidam
  Homework Problem Travisbulls34 1 2,970 Sep-11-2018, 04:04 PM
Last Post: ichabod801
  Help with homework problem - iterating a function midnitetots12 4 3,537 Feb-21-2018, 10:51 PM
Last Post: nilamo
  Problem with a homework Samuelcu 2 2,857 Feb-03-2018, 01:39 PM
Last Post: Samuelcu
  Homework problem Dem_Prorammer 1 3,819 May-20-2017, 07:49 PM
Last Post: ichabod801

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020