Eigener Datenformatierungscode
import pandas as pd
def load_sampledata():
data = pd.read_csv(r'pycaret_sample.csv',
encoding='shift-jis',
engine='python',
index_col=[0],
parse_dates=[0])
data = data.resample('h').sum()
data['hour'] = data.index.hour
data['date'] = data.index.strftime('%Y-%m-%d (%a)')
dataset = data.pivot(index='hour',columns='date',values='Elektrische Energie')
dataset = dataset.T.reset_index()
return dataset
setup
from pycaret.clustering import *
clu = setup(data = load_sampledata(),normalize=True)
Sie können den Inhalt des Setups überprüfen
PyCaret-Modellierung + Plotten: 2 Linien
create_model&plot
# creating a model
hclust = create_model('hclust')
# plotting a model
plot_model(hclust,plot='cluster',feature='date')
Recommended Posts