<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>
{'fraction_non_alphanumeric': 0.13361702127659575, 'fraction_numerical': 0.020425531914893616, 'mean_word_length': 8.882352941176471, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 10, 'https://': 0, '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': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '200038', 'license': 'MIT', 'n_tokens_mistral': 440, 'n_tokens_neox': 422, 'n_words': 79, 'path': 'notebooks/exploratory_stage/1.0-ajmk-explore-solar-data-clusters.ipynb', 'repo_name': 'alexanderkell/temporal_granularity', 'size': '1175'}