Updates for 2025 #105
Replies: 4 comments 1 reply
-
Scikit-Learn NotebookSection 1.2.1 - Filling missing valuesPandas Using
To fix, use Example: # Fill the missing values in the Make column
# Note: In previous versions of pandas, inplace=True was possible, however this will be changed in a future version, can use reassignment instead.
# Old (will produce a warning)
# car_sales_missing["Make"].fillna(value="missing", inplace=True)
# New
car_sales_missing["Make"] = car_sales_missing["Make"].fillna(value="missing") Another example: # Note: In previous versions of pandas, inplace=True was possible, however this will be changed in a future version, can use reassignment instead.
# Old (will produce a warning)
# car_sales_missing["Colour"].fillna(value="missing", inplace=True)
# New
car_sales_missing["Colour"] = car_sales_missing["Colour"].fillna(value="missing") |
Beta Was this translation helpful? Give feedback.
-
Heart Disease Classification NotebookTODO
Notes
Log
Changes
Old: y = df.target.values New: y = df.target.to_numpy() |
Beta Was this translation helpful? Give feedback.
-
Bulldozer Price Prediction Project (regression)
TODO
Log
ChangesCreated v2 of the end to end notebookKept original version of the notebook as v1, added an updated version as v2.
pandas datatype API
Old: for label, content in df_tmp.items():
if pd.api.types.is_string_dtype(content):
print(label) New: for label, content in df_tmp.items():
if pd.api.types.is_object_dtype(content): # using object dtype check
print(label) Converting strings/object columns to categoriesInstead of only finding string columns to convert their values to categories, can now directly find object (object datatype can be string or mixed) columns and convert their values to Old: for label, content in df_tmp.items():
if pd.api.types.is_string_dtype(content):
df_tmp[label] = content.astype("category").cat.as_ordered() New: # This will turn all of the string values into category values
for label, content in df_tmp.items():
if pd.api.types.is_object_dtype(content):
df_tmp[label] = df_tmp[label].astype("category") # use astype() for type conversion Rename save file to be different namesThe processed data file names were poor. Updated them to reflect the original dataset name as well as the actual changes that were made. Old: # Save preprocessed data
df_tmp.to_csv("../data/bluebook-for-bulldozers/train_tmp.csv",
index=False) New: # Save preprocessed data
df_tmp.to_csv("../data/bluebook-for-bulldozers/TrainAndValid_object_values_as_categories.csv", # includes original dataset name (TrainAndValid)
index=False) Updated
|
Beta Was this translation helpful? Give feedback.
-
I will wait for new upcoming course many thanks friend for providing awesome courses.....I really appreciate it. |
Beta Was this translation helpful? Give feedback.
-
Starting a discussion for 2025 updates (starting 4 September 2024).
Will update this over time with more information on changes.
Setup
clone repo
->pip install requirements.txt
->jupyter notebook
orjupyterlab
-> open notebook -> start codingpyarrow
orfastparquet
(for saving toparquet
filetype)Notebooks
Projects
Misc
Beta Was this translation helpful? Give feedback.
All reactions