0% found this document useful (0 votes)
4 views5 pages

Predictive Maintenance with Pandas Analysis

The document outlines tasks for predictive maintenance analysis using Pandas, focusing on data exploration and feature analysis of machine parameters to predict failures. It includes a dataset with 10,000 records and various machine features, along with specific questions and tasks for data manipulation and analysis. Additionally, it presents a scenario for building a shopping cart validator and several programming tasks involving data processing and manipulation.

Uploaded by

Ganesh Tanpure
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views5 pages

Predictive Maintenance with Pandas Analysis

The document outlines tasks for predictive maintenance analysis using Pandas, focusing on data exploration and feature analysis of machine parameters to predict failures. It includes a dataset with 10,000 records and various machine features, along with specific questions and tasks for data manipulation and analysis. Additionally, it presents a scenario for building a shopping cart validator and several programming tasks involving data processing and manipulation.

Uploaded by

Ganesh Tanpure
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Task 1

Predictive Maintenance Analysis using Pandas

You are a Data Scientist at an advanced manufacturing plant. The company has deployed
sensors to monitor various machine parameters like temperature, speed, torque, and tool wear.
The operations team wants to reduce unplanned downtimes by analyzing machine behavior and
predicting failures in advance. Your role is to conduct data exploration and feature analysis
using Pandas to extract actionable insights that can feed into future classification models.

Dataset Summary:

●​ Type: Synthetic real-world-like industrial data​

●​ Instances(Records): 10,000​

●​ Features: Air temperature, Process temperature, Rotational speed, Torque, Tool wear,
Machine failure, etc., [refer to CSV]​

●​ Domain: Predictive Maintenance, Manufacturing Analytics

Questions:
1.​ Display the first 10 rows of the dataset​
Hint: Use .head()​

2.​ What are the unique values in the Type column? How many machines of each type
exist?​
Hint: Use .unique() and .value_counts()​

3.​ Select all records where Tool wear is greater than 50.​
Hint: Filtering​

4.​ Rename the column Torque [Nm] to Torque_Nm and Air temperature [K] to
AirTemp_K.​
Hint: Use .rename()​

© Career247
5.​ Check for missing values in each column and report the count.​
Hint: Use .isnull().sum()​

6.​ Filter all rows where the Rotational speed is greater than 1600 and Torque
[Nm] is less than 30.​

7.​ Create a new column called Temp_Diff which is the difference between Process
temperature [K] and Air temperature [K].​

8.​ Group the dataset by Type and compute the average Tool wear and Torque
[Nm] for each type.​
Hint: Use .groupby() and .agg()​

9.​ Sort the dataset in descending order of Tool wear and display the top 5 rows.​

10.​Create a new column Failure_Flag that has value 1 if any of the failure
indicators (TWF, HDF, PWF, OSF, RNF) are 1, else 0.​
Hint: Use row-wise .sum(axis=1) and compare

11.​For each Product ID, compute the total number of failures (Machine failure) it
encountered. Display only those products with more than one failure.​

12.​Use multi-level groupby on Type and Machine failure and compute average
Torque [Nm] and Tool wear [min].​

13.​Replace any zero Rotational speed values with the median of that column.​
Hint: Data imputation​

14.​Find out which machine type had the highest average difference between process
and air temperature (Temp_Diff).​

15.​Filter rows where Tool wear is in the top 10% of the dataset. Then, group by
Type and calculate the average failure rate.​
Hint: Use .quantile() for threshold

© Career247
Variable Information:

1.​ UID – Unique identifier for each record (1 to 10,000).​

2.​ Product ID – Encodes product quality as L (Low), M (Medium), or H (High) with a unique serial.​

3.​ Air temperature [K] – Ambient air temperature around 300K with slight random variation.​

4.​ Process temperature [K] – Process temperature, typically ~10K higher than air temperature.​

5.​ Rotational speed [rpm] – Machine's rotational speed derived from power with noise added.​

6.​ Torque [Nm] – Force applied in rotation, normally around 40 Nm, no negative values.​

7.​ Tool wear [min] – Minutes of tool usage, higher for better product quality.​

8.​ Machine failure – Indicates if any type of machine failure occurred (1 = failure).​

9.​ TWF – Tool wear failure: happens when tool wear exceeds a threshold.​

10.​ HDF – Heat dissipation failure: occurs when temp difference < 8.6K & speed < 1380 rpm.​

11.​ PWF – Power failure: power outside 3500–9000 W range causes failure.​

12.​ OSF – Overstrain failure: excessive tool wear × torque for each product type.​

13.​ RNF – Random failure: small chance (0.1%) of failure unrelated to parameters.​

Task 2

Problem: Smart Shopping Cart Validator

Scenario:​
You're building a simple shopping cart program. The user enters item names as a
comma-separated string (e.g., "milk,eggs,soap"). The program checks:

1.​ Whether each item is available in the store.​

2.​ If it's available, it adds it to the final cart.​

3.​ If the user types an invalid item or leaves it blank, it skips it and prints a warning using
try-except.​

Instructions to the Learner:

Build a shopping cart checker that takes user input and validates each item against
available products. Use a for loop and try-except to handle invalid input
gracefully.

© Career247
Example Input & Output

Input :
Enter items (comma-separated): milk, chips, , eggs, soap, pizza

Output :
'chips' not available in store.
Skipped an item due to error: Empty item
'pizza' is not available in stores.
Final Cart: ['milk', 'eggs', 'soap']

Another Example:

Input:
Enter items (comma-separated): rice, bread, butter

Output:
Final Cart: ['rice', 'bread', 'butter']

Explanation:

●​ "chips" and "pizza" are not in the store list → warning printed.​

●​ Empty item (because of double comma ,,) → handled with try-except.​

●​ Valid items → added to the final cart.​

© Career247
Task 3

1.​ Using a for loop, flatten a nested list like [[1,2], [3,4,5], [6]] without using built-in
sum() or itertools.

2.​ From a DataFrame of student marks, identify students who scored below the
class average in at least two subjects.
Columns: math, science, english.
data = { 'student': ['Alice', 'Bob', 'Charlie', 'David'], 'math': [85, 50, 60, 90],
'science': [78, 65, 55, 95], 'english': [88, 40, 70, 85] } marks_df =
[Link](data)

3.​ Write a function that accepts a Pandas Series of strings and returns a new Series
with only the first vowel removed from each word (case insensitive).

4.​ Given a NumPy array of integers, create a boolean mask that identifies prime
numbers in the array.

5.​ You are building a leaderboard using Pandas. Sort players by score, and if scores
tie, use last_login (more recent is better).

6.​ Show only top 10.


data = { 'player': ['A', 'B', 'C', 'D', 'E'], 'score': [200, 200, 180, 220, 220],
'last_login': ['2025-05-18', '2025-05-19', '2025-05-17', '2025-05-16', '2025-05-20']
} leaderboard_df = [Link](data)

© Career247

You might also like