<jupyter_start><jupyter_text>Split data into days and visualise this data<jupyter_code># Subset data into 2 years for ease of processing
solar.datetime = pd.to_datetime(solar.datetime)
solar_subset = solar[solar.datetime > "2010"]
solar_subset.head()
# Have each day on its own row
solar_subset['date'] = solar_subset['datetime'].dt.date
solar_subset['hour'] = solar_subset['datetime'].dt.hour
solar_subset.head()
each_day = solar_subset.pivot(index='date', columns='hour', values='capacity_factor')
each_day = each_day.dropna()
each_day.head()
# Visualise as PCA
pca = PCA(n_components=4)

pca_results = pca.fit_transform(each_day)

principal_df = pd.DataFrame(data = pca_results, columns = ['principal component 1', 'principal component 2','principal component 3', 'principal component 4'])
principal_df.plot()
plt.scatter(principal_df['principal component 1'],principal_df['principal component 3'])<jupyter_output><empty_output><jupyter_text>t-SNE<jupyter_code>tsne = TSNE(n_components=2, random_state=0, n_iter=2000, early_exaggeration=4)
each_day_2d = tsne.fit_transform(each_day)

plt.scatter(each_day_2d[:,0], each_day_2d[:,1])
plt.show()<jupyter_output><empty_output>
StarcoderdataJupyterStructuredCleanDedup