Comments (5)
This seems to be more of a Pandas issue.
Pandas doc for idxmin
:
skipna
bool, default True
Exclude NA/null values. If the entire Series is NA, the result will be NA.
This works for and prints out nan
:
import numpy as np
test_series = pd.Series([np.nan, np.nan, np.nan])
print(test_series.idxmin())
But this will throw an error:
test_series = pd.Series([pd.NaT, pd.NaT, pd.NaT])
print(test_series.idxmin()
Looks like no one has wanted to fix this issue for a while now.
from fast-f1.
Pandas will no longer accommodate series with all null values. So the implementation should be changed.
I think if there is no recorded lap time for any lap then pick_fastest
should return None
or similar. The return value we get now with only_by_time=False
is not populated anyways. It is constructed with Lap(index=self.columns)
.
from fast-f1.
Good catch. I agree, maybe we should return None if there are no laps, in both cases.
Let's hear what @theOehrly thinks
from fast-f1.
After thinking about this for a bit, I think that returning None
is in fact the cleanest solution.
(Intentionally) raising an error is not a good solution because the data is only indirectly provided by the user. Therefore, you can't argue that wrong/incompatible data was given by the user. At the same time, no valid fastest lap is an expected scenario. Thus, this is not really an error.
The current solution of returning an empty lap aims for type consistency but at the same time, dtypes of the values in the lap object are incorrect. So it's not really consistent behaviour either.
But changing this to return None
requires a proper deprecation of the current behaviour. I can easily see scripts that would break when this is changed. Therefore, the way to go is to fix the unhandled exception so that an empty Lap object is returned as well. At the same time, add a Deprecation warning that notifies of the upcoming change to returning None instead. The actual change would need to be targeted at v3.3
from fast-f1.
I'll close this one given that this has been addressed, and the pending deprecation has a separate issue as a reminder.
from fast-f1.
Related Issues (20)
- [BUG] get_circuit_info() doesn't work with custom TELEMETRY_FREQUENCY HOT 2
- [BUG] Example ``plot_driver_laptimes.py`` no longer working with latest Seaborn release HOT 11
- [BUG] Data for Piastri in the sprint shootout not available HOT 2
- [BUG] The first lap of a race should not have a PitOutTime HOT 3
- [BUG] Incorrect Qatar Sprint results due to not applied penalties HOT 3
- [BUG] All laps from Singapore and Qatar Grand Prix have IsAccurate=False HOT 3
- [ENH] Add Python 3.12 to test HOT 1
- [BUG] USGP Results | Duplicate entry for TSU and LEC missing data HOT 4
- [BUG] Restart lap times after the red flag HOT 10
- Ergast ShuttingDown HOT 1
- [DEPR] ``pick_fastest`` needs to return ``None`` instead of empty ``Lap`` HOT 1
- Rainfall Data wrong in Weather Data for some GPs HOT 2
- install pyproject.toml-based projects HOT 10
- [ENH] Drivers colors HOT 7
- [BUG] Las Vegas FP1, FP3 and Race failing to load HOT 4
- [BUG] Incorrect data Las Vegas Race HOT 3
- [ENH] Telemetry DataFrame should include DriverId HOT 9
- Lap to grid + formation lap part of the data for Sprint Shootout and Race sessions HOT 2
- [BUG] Driver CountryCode is not populated in the SessionResults object HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fast-f1.