Generazione grafico da dataframe concentrato in una funzione
This commit is contained in:
@@ -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_df(dataframe):
|
||||||
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,
|
||||||
|
x=dataframe.index,
|
||||||
y='gen_pv_100_kWp',
|
y='gen_pv_100_kWp',
|
||||||
title='Produttività Fotovoltaica nel Tempo',
|
title='Produttività Fotovoltaica nel Tempo',
|
||||||
labels={'gen_pv_100_kWp': 'Energia [kWh]', 'index': 'Data/Ora'}
|
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):
|
||||||
"""
|
"""
|
||||||
@@ -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')
|
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}")
|
||||||
|
|
||||||
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')
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user