mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-07 00:11:41 +08:00
update
This commit is contained in:
40
leetcode/problem/display-the-first-three-rows.html
Normal file
40
leetcode/problem/display-the-first-three-rows.html
Normal file
@@ -0,0 +1,40 @@
|
||||
<pre>
|
||||
DataFrame: <code>employees</code>
|
||||
+-------------+--------+
|
||||
| Column Name | Type |
|
||||
+-------------+--------+
|
||||
| employee_id | int |
|
||||
| name | object |
|
||||
| department | object |
|
||||
| salary | int |
|
||||
+-------------+--------+
|
||||
</pre>
|
||||
|
||||
<p>Write a solution to display the <strong>first <code>3</code> </strong>rows<strong> </strong>of this DataFrame.</p>
|
||||
|
||||
<p> </p>
|
||||
<p><strong class="example">Example 1:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>Input:
|
||||
</strong>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 |
|
||||
+-------------+-----------+-----------------------+--------+
|
||||
<strong>Output:</strong>
|
||||
+-------------+---------+-------------+--------+
|
||||
| employee_id | name | department | salary |
|
||||
+-------------+---------+-------------+--------+
|
||||
| 3 | Bob | Operations | 48675 |
|
||||
| 90 | Alice | Sales | 11096 |
|
||||
| 9 | Tatiana | Engineering | 33805 |
|
||||
+-------------+---------+-------------+--------+
|
||||
<strong>Explanation:</strong>
|
||||
Only the first 3 rows are displayed.</pre>
|
Reference in New Issue
Block a user