LoslegenKostenlos loslegen

Manual feature extraction I

You want to compare prices for specific products between stores. The features in the pre-loaded dataset sales_df are: storeID, product, quantity and revenue. The quantity and revenue features tell you how many items of a particular product were sold in a store and what the total revenue was. For the purpose of your analysis it's more interesting to know the average price per product.

Diese Übung ist Teil des Kurses

Dimensionality Reduction in Python

Kurs anzeigen

Anleitung zur Übung

  • Calculate the product price from the quantity sold and total revenue.
  • Drop the quantity and revenue features from the dataset.

Interaktive Übung

Vervollständige den Beispielcode, um diese Übung erfolgreich abzuschließen.

# Calculate the price from the quantity sold and revenue
sales_df['price'] = ____

# Drop the quantity and revenue features
reduced_df = sales_df.drop(____, axis=1)

print(reduced_df.head())
Code bearbeiten und ausführen