mirror of
				https://gitee.com/coder-xiaomo/leetcode-problemset
				synced 2025-11-04 03:33:12 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			42 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			42 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
<pre>
 | 
						|
DataFrame: <code>employees</code>
 | 
						|
+-------------+--------+
 | 
						|
| Column Name | Type   |
 | 
						|
+-------------+--------+
 | 
						|
| employee_id | int    |
 | 
						|
| name        | object |
 | 
						|
| department  | object |
 | 
						|
| salary      | int    |
 | 
						|
+-------------+--------+
 | 
						|
</pre>
 | 
						|
 | 
						|
<p>编写一个解决方案,显示这个 DataFrame 的<strong> 前  <code>3</code> </strong>行。</p>
 | 
						|
 | 
						|
<p> </p>
 | 
						|
 | 
						|
<p><b>示例 1:</b></p>
 | 
						|
 | 
						|
<pre>
 | 
						|
<strong>输入:
 | 
						|
</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  |
 | 
						|
+-------------+-----------+-----------------------+--------+
 | 
						|
<b>输出:</b>
 | 
						|
+-------------+---------+-------------+--------+
 | 
						|
| employee_id | name    | department  | salary |
 | 
						|
+-------------+---------+-------------+--------+
 | 
						|
| 3           | Bob     | Operations  | 48675  |
 | 
						|
| 90          | Alice   | Sales       | 11096  |
 | 
						|
| 9           | Tatiana | Engineering | 33805  |
 | 
						|
+-------------+---------+-------------+--------+
 | 
						|
<b>解释:</b>
 | 
						|
只有前 3 行被显示。</pre>
 |