24.7.6_C学习记录

问题一


typedef int(myTypeArray)[10]; 可以写成typedef int arr [10] myTypeArray吗?

#define  _CRT_SECURE_NO_WARNINGS 
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
void main(void)
{
	int a[10]; //a代表的是数组首元素的地址  &a代表整个数组的地址  a+1 4  &a+1步长 40 .

	//
	{
		//定义一个数组类型
		typedef int(myTypeArray)[10]; //
		myTypeArray myArray;
		myArray[0] = 10;
		myArray[1] = 11;
		printf("%d \n", myArray[0]);
		printf("%d \n", myArray[1]);
	}

	{
		//定义一个指针数组类型 
		typedef int(*PTypeArray)[10];  //int *p 

		PTypeArray myPArray; //sizeof(int) *10
		myPArray = &a;
		//int b = 10;
		//int *p = NULL;
		//p = &b;
		(*myPArray)[0] = 20;

		printf("a[0]: %d \n", a[0]);

	}

	{
		//定义一个指向 数组类型的指针 数组类的指针

		int(*MyPointer)[10]; //变量 告诉C编译器 给我分配内存
		MyPointer = &a;
		(*MyPointer)[0] = 40;
		printf("a[0]: %d \n", a[0]);
	}

	printf("he
import pandas as pd import numpy as np import matplotlib.pyplot as plt from statsmodels.tsa.arima.model import ARIMA from statsmodels.graphics.tsaplots import plot_acf, plot_pacf plt.rcParams['font.sans-serif']=['SimHei'] import matplotlib as mpl mpl.rcParams['axes.unicode_minus'] = False import warnings warnings.filterwarnings("ignore") years = range(1997, 2004) months = range(1, 13) data = [ [9.4, 11.3, 16.8, 19.8, 20.3, 18.8, 20.9, 24.9, 24.7, 24.3, 19.4, 18.6], [9.6, 11.7, 15.8, 19.9, 19.5, 17.8, 17.8, 23.3, 21.4, 24.5, 20.1, 15.9], [10.1, 12.9, 17.7, 21, 21, 20.4, 21.9, 25.8, 29.3, 29.8, 23.6, 16.5], [11.4, 26, 19.6, 25.9, 27.6, 24.3, 23, 27.8, 27.3, 28.5, 32.8, 18.5], [11.5, 26.4, 20.4, 26.1, 28.9, 28, 25.2, 30.8, 28.7, 28.1, 22.2, 20.7], [13.7, 29.7, 23.1, 28.9, 29, 27.4, 26, 32.2, 31.4, 32.6, 29.2, 22.9], [15.4, 17.1, 23.5, 11.6, 1.78, 2.61, 8.8, 16.2, None, None, None, None] ] df = pd.DataFrame(data, columns=range(1, 13), index=range(1997, 2004)) df.index.name = '年份' # 平稳性检验 def test_stationarity(timeseries): # 将数组转换为 Series 对象 series = pd.Series(timeseries) # 计算移动平均和移动标准差 rolling_mean = series.rolling(window=3).mean() rolling_std = series.rolling(window=3).std() # 绘制移动平均和移动标准差 plt.figure(figsize=(10, 6),dpi=500) plt.plot(series.values.flatten(), label='原始数据') plt.plot(rolling_mean.values.flatten(), label='移动平均') plt.plot(rolling_std.values.flatten(), label='移动标准差') plt.xlabel('月数') plt.ylabel('接待人数(万人)') plt.title('移动平均和移动标准差') plt.legend() plt.show() # 执行ADF单位根检验 from statsmodels.tsa.stattools import adfuller result = adfuller(series.dropna()) print('ADF检验结果:') print(f'ADF统计量: {result[0]}') print(f'p-value: {result[1]}') print(f'临界值: {result[4]}') # 进行平稳性检验 test_stationarity(df.stack().values.flatten()) # 差分处理 df_diff = df.diff().dropna()
06-06
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值