开始使用免费开始使用

Stacking regional listings

You are a data analyst at an accommodation booking company. Your team received the listings data split across several files by region: coastal properties, inland properties, and island getaways. Before running any analysis, you need to combine these segmented DataFrames into one.

polars is loaded as pl. The DataFrames coastal, inland, and islands are available with matching columns describing each property.

本练习是课程的一部分

Data Transformation with Polars

查看课程

练习说明

  • Combine coastal, inland, and islands into a single DataFrame called hotels by stacking the rows.
  • Print the first 10 rows to verify the result.

交互式实操练习

通过完成这段示例代码来试试这个练习。

# Combine the regional DataFrames vertically
hotels = pl.____([coastal, inland, islands], how="____")

# Print the first 10 rows
print(hotels.____(____))
编辑并运行代码