ควิซ AI & Machine Learning: Pandas groupby & merge

Most feature engineering in pandas comes down to grouping rows and joining tables. This quiz tests groupby() with sum, size, mean and transform, and how the how argument of merge() changes the number of rows you get back.

ปานกลาง 10 ข้อ ~6 นาที ผ่านที่ 80%

เลือกโหมด

กำลังเล่นแบบผู้เยี่ยมชม: เข้าสู่ระบบเพื่อเก็บ XP และ streak

ตัวอย่างคำถาม

ข้อ 1 จาก 10

What does this print?

import pandas as pd
sales = pd.DataFrame({"city": ["Hanoi", "Hue", "Hanoi", "Hue", "Da Nang"],
                      "amount": [10, 5, 20, 15, 8]})
print(sales.groupby("city")["amount"].sum().to_dict())
ดูเฉลย

B. {'Da Nang': 8, 'Hanoi': 30, 'Hue': 20} Each city's amounts are added (Hanoi 10 + 20, Hue 5 + 15) and, by default, the group keys come out sorted alphabetically, so Da Nang is first. Pass sort=False to keep first-seen order.

ควิซนี้มีเนื้อหาอะไรบ้าง

  • groupby() with sum(), size() and mean()
  • Group keys are sorted by default
  • transform() vs aggregation
  • Inner, left and outer merges and their row counts
  • Overlapping column names and the _x / _y suffixes

คำถามที่พบบ่อย

ต้องมีบัญชีไหม?

ไม่ต้อง ใครก็เล่นได้ เข้าสู่ระบบเพื่อเก็บ XP, streak, เหรียญตรา และประวัติ

ทำซ้ำได้ไหม?

ได้ ระบบเก็บคะแนนที่ดีที่สุดไว้ และสลับคำถามกับตัวเลือกใหม่ทุกครั้ง