Created
June 16, 2024 21:22
-
-
Save mj-ml/aed3d1fa0601e519ca412edbb8c699c5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| categorical = ['PULocationID', 'DOLocationID'] | |
| def read_data(filename): | |
| df = pd.read_parquet(filename) | |
| df['duration'] = df.tpep_dropoff_datetime - df.tpep_pickup_datetime | |
| df['duration'] = df.duration.dt.total_seconds() / 60 | |
| df = df[(df.duration >= 1) & (df.duration <= 60)].copy() | |
| df[categorical] = df[categorical].fillna(-1).astype('int').astype('str') | |
| return df |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment