1. Rupture

import os
import pandas as pd
import glob
import datetime
import matplotlib.pyplot as plt
import statsmodels.api as sm
import seaborn as sns
import statsmodels.api as sm
from scipy import stats
from sklearn.preprocessing import LabelEncoder
import numpy as np
#pd.options.display.float_format = '{:.10f}'.format #표 전체 다보이
# 안잘리게 설정
pd.set_option('display.max_row', 3000)
pd.set_option('display.max_columns', 1000)

breaks_rpt = []
for i in breaks:
    breaks_rpt.append(Data_F.index[i-1])
#breaks_rpt = pd.to_datetime(breaks_rpt)
breaks_rpt




plt.plot(y, label='data')
print_legend = True
for i in breaks_rpt:
    if print_legend:
        plt.axvline(i, color='red',linestyle='dashed', label='breaks')
        print_legend = False
    else:
        plt.axvline(i, color='red',linestyle='dashed')
plt.grid()
plt.legend()
plt.show()

 

 

 

2. jenkspy

https://github.com/mthh/jenkspy

 

GitHub - mthh/jenkspy: Compute Natural Breaks in Python (Fisher-Jenks algorithm)

Compute Natural Breaks in Python (Fisher-Jenks algorithm) - GitHub - mthh/jenkspy: Compute Natural Breaks in Python (Fisher-Jenks algorithm)

github.com

 

 

 

- Rupture 은 이상치 value 를 뽑아내고

- jenkspy 는 이상치 key 를 뽑아준다.

+ Recent posts