mirror of
				https://gitee.com/coder-xiaomo/leetcode-problemset
				synced 2025-11-04 11:43:12 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			31 lines
		
	
	
		
			902 B
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			31 lines
		
	
	
		
			902 B
		
	
	
	
		
			HTML
		
	
	
	
	
	
<p>Write a solution to <strong>create</strong> a DataFrame from a 2D list called <code>student_data</code>. This 2D list contains the IDs and ages of some students.</p>
 | 
						|
 | 
						|
<p>The DataFrame should have two columns, <code>student_id</code> and <code>age</code>, and be in the same order as the original 2D list.</p>
 | 
						|
 | 
						|
<p>The result format is in the following example.</p>
 | 
						|
 | 
						|
<p> </p>
 | 
						|
<p><strong class="example">Example 1:</strong></p>
 | 
						|
 | 
						|
<pre>
 | 
						|
<strong>Input:
 | 
						|
</strong>student_data:<strong>
 | 
						|
</strong><code>[
 | 
						|
  [1, 15],
 | 
						|
  [2, 11],
 | 
						|
  [3, 11],
 | 
						|
  [4, 20]
 | 
						|
]</code>
 | 
						|
<strong>Output:</strong>
 | 
						|
+------------+-----+
 | 
						|
| student_id | age |
 | 
						|
+------------+-----+
 | 
						|
| 1          | 15  |
 | 
						|
| 2          | 11  |
 | 
						|
| 3          | 11  |
 | 
						|
| 4          | 20  |
 | 
						|
+------------+-----+
 | 
						|
<strong>Explanation:</strong>
 | 
						|
A DataFrame was created on top of student_data, with two columns named <code>student_id</code> and <code>age</code>.
 | 
						|
</pre>
 |