2024-01-09|閱讀時間 ‧ 約 0 分鐘

Display the First Three Rows 回傳資料表的前3個Row_Intro to Pandas


題目敘述

題目會給定一個pandas DataFrame作為輸入,要求我們回傳資料表的前3個Row。

題目的原文敘述


測試範例

Example 1:

Input:
DataFrame employees
+-------------+-----------+-----------------------+--------+
| employee_id | name | department | salary |
+-------------+-----------+-----------------------+--------+
| 3 | Bob | Operations | 48675 |
| 90 | Alice | Sales | 11096 |
| 9 | Tatiana | Engineering | 33805 |
| 60 | Annabelle | InformationTechnology | 37678 |
| 49 | Jonathan | HumanResources | 23793 |
| 43 | Khaled | Administration | 40454 |
+-------------+-----------+-----------------------+--------+
Output:
+-------------+---------+-------------+--------+
| employee_id | name | department | salary |
+-------------+---------+-------------+--------+
| 3 | Bob | Operations | 48675 |
| 90 | Alice | Sales | 11096 |
| 9 | Tatiana | Engineering | 33805 |
+-------------+---------+-------------+--------+
Explanation:
Only the first 3 rows are displayed.
回傳資料表的前3個row​

分享至
成為作者繼續創作的動力吧!
© 2024 vocus All rights reserved.