目录
一、案例背景
随着无人机技术的成熟、政策的逐步放开以及市场需求的多样化,低空经济正迅速崛起,成为经济发展的新引擎。从物流配送、农林植保、测绘勘探到应急救援等多个领域,低空经济展现出了巨大的潜力和应用价值。通过 Python 对低空经济行业相关数据进行全面且深入的分析,能够清晰地呈现出该行业的发展现状、市场规模的增长趋势、应用场景的拓展情况以及面临的挑战,为行业从业者、投资者、政策制定者等提供关键的决策支持,助力各方在低空经济这片新兴蓝海中找准方向,实现快速发展。
二、代码实现
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import requests
from bs4 import BeautifulSoup
2.1 数据收集
数据来源涵盖专业航空航天资讯平台(如 Aviation Week Network、FlightGlobal)、行业研究机构报告(如 Gartner 针对新兴技术的报告、专门的无人机行业研究机构报告)、政府部门发布的政策法规和统计数据(如民航局、工信部)以及相关企业的公开财报和产品数据。
- 从专业航空航天资讯平台收集低空经济相关新闻文章数据,以 Aviation Week Network 为例:
url = 'https://www.aviationweek.com/search/site/low-altitude%20economy'
headers = {
'User - Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36'
}
response = requests.get(url, headers = headers)
soup = BeautifulSoup(response.text, 'html.parser')
article_data = []
article_items = soup.find_all('div', class_='search-result')
for item in article_items:
title = item.find('h3').text.strip()
summary = item.find('p').text.strip()
publish_time = item.find('time')['datetime']
article_data.append({'Title': title, 'Summary': summary, 'Publish_Time': publish_time})
article_df = pd.DataFrame(article_data)
- 从行业研究机构网站获取低空经济市场规模、无人机出货量等数据,假设通过其提供的 API 获取(实际需依 API 文档开发):
# 示例结构,实际实现需依API文档
import json
url = 'https://api.droneindustryinsights.com/low_altitude_economy_data'
headers = {
'Authorization': 'your_api_key',
'Content - Type': 'application/json'
}
response = requests.get(url, headers = headers)
if response.status_code == 200:
industry_data = json.loads(response.text)
industry_df = pd.DataFrame(industry_data)
else:
print('Failed to get industry data')
2.2 数据探索性分析
# 查看文章数据基本信息
print(article_df.info())
# 查看行业数据基本信息
print(industry_df.info())
# 统计文章发布时间分布
article_df['Publish_Time'] = pd.to_datetime(article_df['Publish_Time'])
article_df['Month'] = article_df['Publish_Time'].dt.month
month_count = article_df['Month'].value_counts().sort_index()
plt.figure(figsize=(12, 6))
sns.barplot(x = month_count.index, y = month_count.values)
plt.title('Distribution of Low - Altitude Economy Article Publication Months')
plt.xlabel('Month')
plt.ylabel('Article Count')
plt.show()
# 查看低空经济市场规模随时间变化趋势(假设市场数据有时间和规模字段)
industry_df['Time'] = pd.to_datetime(industry_df['Time'])
plt.figure(figsize=(12, 6))
sns.lineplot(x = 'Time', y = 'Market_Size', data = industry_df)
plt.title('Trend of Low - Altitude Economy Market Size')
plt.xlabel('Time')
plt.ylabel('Market Size (in billions)')
plt.show()
2.3 数据清洗
# 文章数据清洗
# 去除重复文章(根据标题判断)
article_df = article_df.drop_duplicates(subset='Title')
# 处理缺失值
article_df.dropna(inplace = True)
# 行业数据清洗
# 检查数据完整性,处理异常值
industry_df = ind