AnalystPath

Notable National Parks

PandasEasyJunior level~10 min

Problem

DataFrame: `nationalpark` (`nationalpark.csv`)

```text
+-----------------+--------+
| Column | Type |
+-----------------+--------+
| park_name | object |
| region | object |
| area_sq_km | int |
| annual_visitors | int |
+-----------------+--------+
park_name uniquely identifies each park. One row per park.
```

A park counts as **notable** if EITHER of these holds:

- its `area_sq_km` is at least 4000, OR
- its `annual_visitors` is at least 1000000.

Return the `park_name`, `annual_visitors`, and `area_sq_km` of every notable park, in any order.

Input data

Example rows — the live problem includes the full dataset.

nationalpark
park_nameregionarea_sq_kmannual_visitors
Cedar RidgeNorth5200320000
Maple HollowEast76095000
Granite FallsWest11001450000
Willow MarshSouth24018000
Pine CrestNorth64002100000

Expected output

Your answer should return 3 rows with the columns park_name, annual_visitors, area_sq_km.

Starter code (Pandas (Python))

import pandas as pd

def notable_parks(nationalpark: pd.DataFrame) -> pd.DataFrame:
    # Your code here
    return nationalpark

Solve this Pandas question free

Write Pandas (Python) and run it instantly in your browser — even on your phone. No signup needed to try.

Solution & explanation

Create a free account to unlock the optimal solution, a step-by-step explanation, and the hidden test cases that grade your answer.

Sign up free to unlock

Related Pandas questions