Method Chaining 函式呼叫鍊_Intro to Pandas

2024/01/10閱讀時間約 6 分鐘


題目敘述

題目會給定一個pandas DataFrame作為輸入,要求我們列出所有體重>100公斤的動物的名字,並且必須依照體重weight降序排列


題目的原文敘述


測試範例

Example 1:

Input: 
DataFrame animals:
+----------+---------+-----+--------+
| name | species | age | weight |
+----------+---------+-----+--------+
| Tatiana | Snake | 98 | 464 |
| Khaled | Giraffe | 50 | 41 |
| Alex | Leopard | 6 | 328 |
| Jonathan | Monkey | 45 | 463 |
| Stefan | Bear | 100 | 50 |
| Tommy | Panda | 26 | 349 |
+----------+---------+-----+--------+
Output:
+----------+
| name |
+----------+
| Tatiana |
| Jonathan |
| Tommy |
| Alex |
+----------+
Explanation:
All animals weighing more than 100 should be included in the results table.
Tatiana's weight is 464, Jonathan's weight is 463, Tommy's weight is 349, and Alex's weight is 328.
The results should be sorted in descending order of weight.

約束條件

以行動支持創作者!付費即可解鎖
本篇內容共 2759 字、0 則留言,僅發佈於Introduction to Pandas 入門題解你目前無法檢視以下內容,可能因為尚未登入,或沒有該房間的查看權限。
46會員
290內容數
由有業界實戰經驗的演算法工程師, 手把手教你建立解題的框架, 一步步寫出高效、清晰易懂的解題答案。 著重在讓讀者啟發思考、理解演算法,熟悉常見的演算法模板。 深入淺出地介紹題目背後所使用的演算法意義,融會貫通演算法與資料結構的應用。 在幾個經典的題目融入一道題目的多種解法,或者同一招解不同的題目,擴展廣度,並加深印象。
留言0
查看全部
發表第一個留言支持創作者!