Loading
Loading
في هذا الدرس تطبّق كل ما تعلّمته في مشروع متكامل — من تحميل البيانات إلى الرسوم البيانية والاستنتاجات.
الهدف: تحليل مجموعة بيانات وظائف AI لاستخراج رؤى تساعد في بناء مسار مهني.
المهارات المستخدمة: Python · NumPy · Pandas · Matplotlib
import pandas as pd, numpy as np, matplotlib.pyplot as plt, io
# البيانات كنص CSV مدمج مباشرة في الكود
raw = 'job,salary,exp,skill
Data Scientist,120000,3,Python
ML Engineer,150000,5,PyTorch'
df = pd.read_csv(io.StringIO(raw))
print(f"الحجم: {df.shape}")
print(df.describe().round(0))
df["monthly"] = (df["salary"] / 12).astype(int)
df["seniority"] = pd.cut(df["exp"], bins=[0,2,5,99],
labels=["مبتدئ","متوسط","خبير"])
df["roi"] = (df["demand"] * df["salary"] / 100_000).round(2)
corr = df["exp"].corr(df["salary"])
print(f"ارتباط الخبرة بالراتب: {corr:.2f}")
top3 = df.nlargest(3, "salary")[["job","salary"]]
print(top3.to_string(index=False))
level_avg = df.groupby("seniority", observed=True)["salary"].mean()
print(level_avg)
fig, axes = plt.subplots(1, 2, figsize=(12, 5))
axes[0].barh(df["job"], df["salary"]/1000, color="#2196F3")
axes[0].set_title("الراتب (ألف $)")
axes[1].scatter(df["exp"], df["salary"]/1000, alpha=0.8)
axes[1].set_title("الخبرة × الراتب")
plt.tight_layout()
plt.savefig("ai_jobs.png", dpi=120, bbox_inches="tight")
plt.show()
best = df.loc[df["roi"].idxmax()]
print(f"✅ أفضل وظيفة: {best['job']} (${best['salary']:,})")
print("💡 مسار: Python → ML → APIs → Deploy")
هذا هو بالضبط سير عمل Data Scientist الحقيقي.
# ─── المشروع الكامل: تحليل سوق وظائف AI ───
import pandas as pd, numpy as np, matplotlib.pyplot as plt, io
lines = [
"job_title,salary_usd,exp_yr,top_skill,remote,demand_score",
"Data Scientist,120000,3,Python,True,9.2",
"ML Engineer,150000,5,PyTorch,True,9.5",
"AI Researcher,160000,7,Research,False,8.8",
"Data Analyst,85000,2,SQL,True,8.5",
"NLP Engineer,140000,4,NLP,True,8.9",
"CV Engineer,135000,4,OpenCV,False,8.7",
"MLOps Engineer,145000,6,Docker,True,9.0",
"AI Product Mgr,130000,5,Strategy,True,8.3",
"Data Engineer,125000,4,Spark,False,8.8",
"LLM Engineer,155000,3,LangChain,True,9.4",
]
df = pd.read_csv(io.StringIO("
".join(lines)))
print("=== الاستكشاف ===")
print(f"الحجم: {df.shape[0]} وظيفة x {df.shape[1]} خاصية")
df["monthly"] = (df["salary_usd"] / 12).astype(int)
df["seniority"] = pd.cut(df["exp_yr"], bins=[0,2,5,99],
labels=["مبتدئ","متوسط","خبير"])
df["roi"] = (df["demand_score"] * df["salary_usd"] / 100_000).round(2)
print("
=== إحصاء الرواتب ($) ===")
print(df["salary_usd"].describe().apply(lambda x: f"${x:,.0f}"))
corr = np.corrcoef(df["exp_yr"], df["salary_usd"])[0,1]
print(f"
📈 ارتباط الخبرة بالراتب: {corr:.3f}")
print("
🏆 أعلى 3 رواتب:")
top = df.nlargest(3,"salary_usd")[["job_title","salary_usd"]]
print(top.to_string(index=False))
print("
=== متوسط الراتب حسب المستوى ===")
lv = df.groupby("seniority", observed=True)["salary_usd"].agg(["mean","count"])
for lvl, row in lv.iterrows():
print(f" {lvl}: ${row['mean']:,.0f} ({int(row['count'])} وظيفة)")
remote_pct = df["remote"].mean() * 100
print(f"
🏠 وظائف عن بُعد: {remote_pct:.0f}%")
fig, axes = plt.subplots(2, 2, figsize=(14, 9))
fig.suptitle("تحليل سوق وظائف الذكاء الاصطناعي 2025",
fontsize=14, fontweight="bold")
sd = df.sort_values("salary_usd")
clr = ["#4CAF50" if r else "#F44336" for r in sd["remote"]]
axes[0,0].barh(sd["job_title"], sd["salary_usd"]/1000, color=clr, alpha=0.85)
axes[0,0].set_title("الراتب (أخضر=بُعد، أحمر=حضوري)")
sc = axes[0,1].scatter(df["exp_yr"], df["salary_usd"]/1000,
c=df["demand_score"], cmap="RdYlGn",
s=df["demand_score"]*18, alpha=0.8)
plt.colorbar(sc, ax=axes[0,1], label="الطلب")
axes[0,1].set_title("الخبرة × الراتب")
rs = df.sort_values("roi", ascending=False)
axes[1,0].bar(range(len(rs)), rs["roi"], color="#9C27B0", alpha=0.8)
axes[1,0].set_xticks(range(len(rs)))
axes[1,0].set_xticklabels([t.split()[0] for t in rs["job_title"]],
rotation=45, ha="right", fontsize=8)
axes[1,0].set_title("ROI Score")
axes[1,1].hist(df["demand_score"], bins=8, color="#2196F3", edgecolor="white")
axes[1,1].axvline(df["demand_score"].mean(), color="red", ls="--", lw=2,
label=f"μ={df['demand_score'].mean():.2f}")
axes[1,1].set_title("توزيع درجة الطلب"); axes[1,1].legend()
plt.tight_layout()
plt.savefig("ai_jobs_analysis.png", dpi=120, bbox_inches="tight")
plt.show()
best = df.loc[df["roi"].idxmax()]
print("
" + "="*40)
print(" التوصيات النهائية")
print("="*40)
print(f"🥇 أفضل وظيفة ROI : {best['job_title']}")
print(f" الراتب : ${best['salary_usd']:,}")
print(f" المهارة : {best['top_skill']}")
print(f"
💡 مسار: Python → NumPy/Pandas → ML → LLMs → Deploy")
print("✅ تم حفظ التحليل في: ai_jobs_analysis.png")