
x32x01
أدارة أكتب كود
- بواسطة x32x01 ||

ما هو مخطط باريتو (Pareto Chart)؟
مخطط باريتو هو أداة تحليلية تعتمد على مبدأ "80/20"، والذي ينص على أن 80% من النتائج غالبًا ما تأتي من 20% من الأسباب.
يُظهر المخطط الأعمدة (التي تمثل التكرار) والخط التراكمي (الذي يُظهر النسبة المجمعة). يُستخدم بشكل واسع في تحليل البيانات لتحديد الأولويات وحل المشكلات.
كيفية إنشاء مخطط باريتو باستخدام بايثون؟


# ١. استيراد المكتبات
Python:
import pandas as pd
import matplotlib.pyplot as plt
# ٢. البيانات الأساسية
Python:
data = {'Category': ['A', 'B', 'C', 'D', 'E'], 'Frequency': [50, 30, 15, 5, 2]}
# ٣. تحويل البيانات إلى DataFrame
Python:
df = pd.DataFrame(data)
# ٤. ترتيب البيانات حسب التكرار
Python:
df = df.sort_values('Frequency', ascending=False)
# ٥. حساب النسبة التراكمية
Python:
df['Cumulative %'] = df['Frequency'].cumsum() / df['Frequency'].sum() * 100
# ٦. رسم الأعمدة والخط التراكمي
Python:
fig, ax1 = plt.subplots()
ax1.bar(df['Category'], df['Frequency'], color='C4') # الأعمدة
ax1.set_ylabel('Frequency') # تسمية المحور الأول
ax2 = ax1.twinx()
ax2.plot(df['Category'], df['Cumulative %'], 'CID') # الخط التراكمي
ax2.set_ylabel('Cumulative %') # تسمية المحور الثاني
# ٧. إضافة العنوان
plt.title('Pareto Chart')
plt.show()
شرح الكود خطوة بخطوة:














لماذا يعتبر مخطط باريتو مهمًا؟



---

سواء كنت مبتدئًا أو محترفًا، تعلم إنشاء مخططات باريتو سيساعدك على تطوير مهاراتك في تحليل البيانات.
