
K-means 클러스트링을 활용한 주가 지지저항 분석 알고리즘이다. import pandas as pdimport numpy as npfrom sklearn.cluster import KMeansdef identify_support_resistance_levels(df, start_date=None, end_date=None, num_clusters = 10 ): if start_date: df = df[df.index >= pd.to_datetime(start_date)] if end_date: df = df[df.index prices.at[i-1, 'High'] and prices.at[i, 'High'] > prices.at[i+1, 'High']: ..