C题:The Development Trend of New Energy Electric Vehicles in China中国谈新能源电动汽车的发展趋势
第一问部分:
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.cluster import KMeans
from sklearn.preprocessing import StandardScaler
import seaborn as sns
from statsmodels.tsa.arima.model import ARIMA
from sklearn.preprocessing import StandardScaler
import matplotlib
# 使用Times New Roman字体
matplotlib.rcParams['font.family'] = 'Times New Roman'
# 绘制折线图
plt.plot(pd_power['磷酸铁锂动力电池装机量/GWh'], label='Lithium',marker='o')
plt.plot(pd_power['三元电池装机量/GWh'], label='SanYuan',marker='o')
# 添加图例
plt.legend(loc='upper left')
# 设置x轴标签和标题
plt.xlabel('Year')
plt.title('Installed capacity/GWh')
plt.xticks([0,1,2,3,4,5,6],pd_power['年份'])
# 显示图表
plt.tight_layout()
plt.show()
import matplotlib
# 使用Times New Roman字体
matplotlib.rcParams['font.family'] = 'Times New Roman'
# 绘制折线图
plt.plot(year_sale_list[::-1], label='NEEV',marker='o')
# 添加图例
plt.legend(loc='upper left')
# 设置x轴标签和标题
plt.xlabel('time')
plt.title('Sales')
plt.xticks([0,1,2,3,4,5,6,7,8],['2015','2016','2017','2018','2019','2020','2021','2022','2023'])
# 显示图表
plt.tight_layout()
plt.show()
相关性分析如下:
dir = {'sale':year_sale_list[5:1:-1],
'subsidy':df_subsidy.iloc[:,2:].sum().values}
dir1 = {
'sale':year_sale_list[6::-1],
'power':pd_power['磷酸铁锂动力电池装机量/GWh'].values
}
df_corr = pd.DataFrame(dir)
df_cor = pd.DataFrame(dir1)
df_cor
df_sale = pd.DataFrame(year_sale_list)
# 计算补贴金额与销售量的相关性
correlation_subsidy = df_corr['sale'].corr(df_corr['subsidy'])
correlation_power = df_cor['sale'].corr(df_cor['power'])
# correlation_tech = df_sale['新能源汽车产销量'].corr(df_tech['每个项目资金支持(万元)'])
# 输出相关性结果
correlation_subsidy, correlation_power
后续代码、讲解视频、论文及其他相关内容,可以点击下面的群名片哦!