Generazione grafico da dataframe concentrato in una funzione
This commit is contained in:
@@ -54,12 +54,13 @@ 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
|
||||
result_ac_energies_to_csv_df.to_csv(path_export, encoding='utf-8')
|
||||
|
||||
def generate_grafico_df(dataframe):
|
||||
# GENERAZIONE GRAFICO
|
||||
import plotly.express as px
|
||||
# Supponendo che la colonna di interesse sia 'gen_pv_100_kWp'
|
||||
fig = px.line(
|
||||
result_ac_energies_to_csv_df,
|
||||
x=result_ac_energies_to_csv_df.index,
|
||||
dataframe,
|
||||
x=dataframe.index,
|
||||
y='gen_pv_100_kWp',
|
||||
title='Produttività Fotovoltaica nel Tempo',
|
||||
labels={'gen_pv_100_kWp': 'Energia [kWh]', 'index': 'Data/Ora'}
|
||||
@@ -75,17 +76,6 @@ def export_hourly_pv_productivity(result_ac_energies_to_csv_df, path_export_hour
|
||||
df_hourly.to_csv(path_export_hourly, encoding='utf-8')
|
||||
print(f"File CSV orario salvato in: {path_export_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
|
||||
path_export_hourly = path_export.replace('.csv', '_hourly.csv')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user