andre non ci sta più capendo un cabbo

This commit is contained in:
2025-06-23 12:13:20 +02:00
parent 570a1eea81
commit e410ab053b

View File

@@ -54,17 +54,18 @@ print("Valore massimo:",max(result_ac_energies_to_csv_df.gen_pv_100_kWp)) # prin
print("Somma totale:",sum(result_ac_energies_to_csv_df.gen_pv_100_kWp)) # print the total sum of the generated energy print("Somma totale:",sum(result_ac_energies_to_csv_df.gen_pv_100_kWp)) # print the total sum of the generated energy
result_ac_energies_to_csv_df.to_csv(path_export, encoding='utf-8') result_ac_energies_to_csv_df.to_csv(path_export, encoding='utf-8')
# GENERAZIONE GRAFICO def generate_grafico_torri_df(dataframe, graphTitle):
import plotly.express as px # GENERAZIONE GRAFICO
# Supponendo che la colonna di interesse sia 'gen_pv_100_kWp' import plotly.express as px
fig = px.line( # Supponendo che la colonna di interesse sia 'gen_pv_100_kWp'
result_ac_energies_to_csv_df, fig = px.line(
x=result_ac_energies_to_csv_df.index, dataframe,
y='gen_pv_100_kWp', x=dataframe.index,
title='Produttività Fotovoltaica nel Tempo', y='gen_pv_100_kWp',
labels={'gen_pv_100_kWp': 'Energia [kWh]', 'index': 'Data/Ora'} title=graphTitle,
) labels={'gen_pv_100_kWp': 'Energia [kWh]', 'index': 'Data/Ora'}
fig.show() )
fig.show()
def export_hourly_pv_productivity(result_ac_energies_to_csv_df, path_export_hourly): def export_hourly_pv_productivity(result_ac_energies_to_csv_df, path_export_hourly):
""" """
@@ -74,23 +75,13 @@ def export_hourly_pv_productivity(result_ac_energies_to_csv_df, path_export_hour
df_hourly = result_ac_energies_to_csv_df.resample('H').sum() df_hourly = result_ac_energies_to_csv_df.resample('H').sum()
df_hourly.to_csv(path_export_hourly, encoding='utf-8') df_hourly.to_csv(path_export_hourly, encoding='utf-8')
print(f"File CSV orario salvato in: {path_export_hourly}") print(f"File CSV orario salvato in: {path_export_hourly}")
return df_hourly
fig = px.line(
df_hourly,
x=df_hourly.index,
y='gen_pv_100_kWp',
title='Produttività Fotovoltaica su Base Oraria',
labels={'gen_pv_100_kWp': 'Energia [kWh]', 'index': 'Data/Ora'}
)
fig.show()
# --- USO DELLA FUNZIONE DOPO L'EXPORT ORIGINALE ---
# Scegli il percorso per il nuovo file orario # Scegli il percorso per il nuovo file orario
path_export_hourly = path_export.replace('.csv', '_hourly.csv') path_export_hourly = path_export.replace('.csv', '_hourly.csv')
# Esporta il file orario # Esporta il file orario
export_hourly_pv_productivity(result_ac_energies_to_csv_df, path_export_hourly) df_hourly = export_hourly_pv_productivity(result_ac_energies_to_csv_df, path_export_hourly)
<<<<<<< HEAD <<<<<<< HEAD
import pandas as pd import pandas as pd
@@ -183,6 +174,11 @@ fig.update_layout(
) )
fig.show() fig.show()
=======
# GENERAZIONE GRAFICI
generate_grafico_torri_df(result_ac_energies_to_csv_df, 'Produttività Fotovoltaica nel Tempo')
generate_grafico_torri_df(df_hourly, 'Produttività Fotovoltaica a Base Oraria')
>>>>>>> 0d40d3730f0ffa115039b3330b8c5cd8e4a090f8
if joePlaying: if joePlaying:
joe.terminate() joe.terminate()