import matplotlib.pyplot as plt # Create a DataFrame with the provided data data = { 'Date': [
Question:
import matplotlib.pyplot as plt
# Create a DataFrame with the provided data
data = {
'Date': [
'01/01/2023', '02/01/2023', '03/01/2023', '04/01/2023', '05/01/2023',
# Add the rest of the dates...
],
'Batches Tested': [
50, 48, 52, 47, 49,
# Add the rest of the data...
],
'Batches Failed': [
2, 1, 3, 2, 3,
# Add the rest of the data...
],
'Successful Batches': [
48, 47, 49, 45, 46,
# Add the rest of the data...
]
}
# Create a new column for failed batches
data['Failed Batches'] = data['Batches Tested'] - data['Successful Batches']
# Calculate the total number of failed and successful batches
total_failed = sum(data['Failed Batches'])
total_successful = sum(data['Successful Batches'])
# Create a pie chart
labels = ['Failed Batches', 'Successful Batches']
sizes = [total_failed, total_successful]
colors = ['red', 'green']
plt.figure(figsize=(8, 8))
plt.pie(sizes, labels=labels, colors=colors, autopct='%1.1f%%', startangle=140)
# Add title
plt.title('Composition of Failed Batches to Successful Batches')
# Show the chart
plt.show()