2023亚太杯数学建模竞赛C题详细代码解析建模

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 

后续代码、讲解视频、论文及其他相关内容,可以点击下面的群名片哦!

  • 7
    点赞
  • 16
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值