<jupyter_start><jupyter_text>ARIMA: [참고 사이트](https://h3imdallr.github.io/2017-08-19/arima/)<jupyter_code>%matplotlib notebook
import pandas as pd
import numpy as np

import matplotlib.pyplot as plt
import seaborn as sns
a = np.random.standard_normal((9, 4))
print ('a=\n', a.round(6))
fun_df = pd.DataFrame(a)
print('fun_df=\n', fun_df)
dates = pd.date_range('2016-1-1', periods=9, freq='M')
print('dates=\n', dates)
fun_df.index = dates
print('fun_df.index=\n', fun_df)
fun_df.index
fun_df.columns
fun_df.loc['2016-02-29']
fun_df.loc[fun_df.index[1:3]]
fun_df[1:3]

fun_df.apply(lambda x: x**2)
fun_df['new'] = np.zeros(9)
fun_df
fun_df.columns = ['A', 'B', 'C', 'D', 'E']

#sum
fun_df.sum()
fun_df.cumsum()

#mean
fun_df.mean()

# std
fun_df.std()

# numpy universal functions
np.sqrt(fun_df)

# general stats
fun_df.describe()
fun_df.plot()
fun_df['Quarter'] = ['Q1', 'Q1', 'Q1', 'Q2', 'Q2', 'Q2', 'Q3', 'Q3', 'Q3']
fun_df
groups = fun_df.groupby('Quarter')
groups
groups.mean()
groups.max()
groups.size()
fun_df['Odd_Even'] = ['Odd', 'Even', 'Odd', 'Even', 'Odd', 'Even', 'Odd', 'Even', 'Odd']
gropus = fun_df.groupby(['Quarter', 'Odd_Even'])
fun_df
groups
groups.size()
groups.mean()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.21510673234811165, 'fraction_numerical': 0.034482758620689655, 'mean_word_length': 6.046242774566474, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '46276', 'license': 'Apache-2.0', 'n_tokens_mistral': 570, 'n_tokens_neox': 558, 'n_words': 106, 'path': 'gantry-jupyterhub/time_series/example/pandas_example.ipynb', 'repo_name': 'jaebongchun/gantry-aiops', 'size': '1218'}