系列】Leetcode Problem: [595. 大的国家]"/>
【pandas刷题系列】Leetcode Problem: [595. 大的国家]
Problem: 595. 大的国家
文章目录
- 思路
- 解题方法
- 复杂度
- Code
思路
筛选出对应的数据,然后将不需要的列去除
解题方法
筛选出对应的数据,然后将不需要的列去除
复杂度
- 时间复杂度:
O ( n ) O(n) O(n)
- 空间复杂度:
O ( n ) O(n) O(n)
Code
import pandas as pddef big_countries(world: pd.DataFrame) -> pd.DataFrame:return world[(world["area"] >= 3000000) | (world["population"] >= 25000000)].drop(columns=["continent","gdp"])
更多推荐
【pandas刷题系列】Leetcode Problem: [595. 大的国家]
发布评论