mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-01-10 18:48:13 +08:00
41 lines
1.5 KiB
HTML
41 lines
1.5 KiB
HTML
<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>
|