0Pricing
Data Science Academy · درس

استخدام concat للتكديس والإلحاق

دمج الجداول عموديًا أو أفقيًا

استخدام concat للتكديس والإلحاق درس مجاني في Data Science Academy على CoddyKit. هذا هو الدرس 3 من أصل 4. يمكنك قراءة الدرس كاملاً أدناه مجاناً — ثم تمرن عليه مباشرة في المتصفح باستخدام محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7. هذا الدرس جزء من مسار التعلم في Data Science Academy، وتقدمك يتزامن عبر الويب وتطبيق CoddyKit. تتضمن دورة Data Science Academy 4 دروس في المجموع.

بعض أجزاء هذا الدرس لم تُترجم بعد وتظهر باللغة الإنجليزية.

Stacking, Not Matching

Sometimes you do not match on a key, you just pile tables together. That job belongs to concat, not merge.

Stack Rows Vertically

Pass a list of frames to concat and it stacks them on top of each other into one taller table.

pd.concat([jan, feb, mar])

A Classic Use Case

Concat shines when you have monthly files with the same columns and want one combined dataset for the year.

Reset the Index

Stacking keeps each frame's original index, so labels repeat. Use ignore_index to renumber rows cleanly.

pd.concat([jan, feb], ignore_index=True)

Glue Side by Side

Set axis=1 and concat joins frames horizontally, placing their columns next to each other by row position.

pd.concat([features, labels], axis=1)

Columns Align by Name

When stacking rows, concat lines up columns by name. Order does not matter, only the labels do.

Missing Columns Get NaN

If one frame is missing a column the other has, concat keeps it and fills the gaps with NaN.

Keep Only Shared Columns

Want columns that exist in every frame only? Pass join="inner" to drop the rest during concat.

pd.concat([a, b], join="inner")

Tag Where Rows Came From

The keys argument labels each chunk, building a tidy MultiIndex so you can tell the sources apart later.

pd.concat([q1, q2], keys=["Q1", "Q2"])

append Is Gone

Older code used DataFrame.append, but it was removed. Reach for concat for every stacking job today.

concat or merge?

Quick rule: concat when you stack frames with the same shape, merge when you match rows on a key column. 🧩

Quick Check

You have twelve monthly CSVs with identical columns. How do you build one table?

Recap: Stacking With concat

You can stack frames by rows or columns, reset the index, control missing columns, and tag sources with keys. Great work!

الأسئلة الشائعة

هل درس «استخدام concat للتكديس والإلحاق» مجاني؟

نعم — نص درس «استخدام concat للتكديس والإلحاق» كامل متاح مجاناً هنا على الويب. لتمرينه بشكل تفاعلي (محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7) وفتح باقي دورة Data Science Academy، انتقل إلى CoddyKit PRO. تتضمن دورة Data Science Academy 4 دروس في المجموع.

ماذا ستتعلم في «استخدام concat للتكديس والإلحاق»؟

دمج الجداول عموديًا أو أفقيًا تتمرن على Data Science Academy مع أكواد عملية تشغلها مباشرة في المتصفح، ومدرس ذكاء اصطناعي متاح 24/7 يجيب على أسئلتك أثناء عملك.

هل أحتاج إلى خبرة سابقة لأبدأ Data Science Academy؟

لا تُشترط خبرة سابقة. Data Science Academy على CoddyKit منظم للمبتدئين حتى المتقدمين، لذا يمكنك البدء من هنا أو من البداية والتقدم بسرعتك الخاصة. هذا هو الدرس 3 من أصل 4.

كم من الوقت يستغرق درس «استخدام concat للتكديس والإلحاق»؟

معظم دروس CoddyKit تستغرق حوالي 5–10 دقائق. كل منها موجز وتفاعلي، لذا تحرز تقدماً مستمراً وتستأنف من حيث توقفت عبر الويب والتطبيق.

هل يمكنني كتابة وتشغيل أكواد في درس Data Science Academy هذا؟

نعم. كل درس في Data Science Academy يتضمن محرر أكواد مدمج، لذا تكتب وتشغل أكواداً حقيقية مباشرة في متصفحك وتحصل على تعليقات فورية من الذكاء الاصطناعي — بدون إعداد محلي.

جميع الدروس في هذه الدورة

  1. الربط الداخلي والأيسر والأيمن والخارجي
  2. الدمج حسب المفاتيح والفهارس
  3. استخدام concat للتكديس والإلحاق
  4. تشخيص عمليات الربط الخاطئة
← العودة إلى Data Science Academy