graph_generator / data_loader.py
juancamval's picture
Create data_loader.py
532c430 verified
raw
history blame
913 Bytes
#Aqui añadiremos la conexion entre Supabase y Huggingface
import pandas as pd
from supabase import create_client, Client
#Aqui van las credenciales, conectar las credenciales de Supabase en "Secrets"
#SUPABASE_URL =
#SUPABASE_KEY =
def load_data():
"""fertility, geo data, labor, population y predictions """
try:
response = supabase.from_("LabourForecast").execute()
if response.error:
st.error(f"Error fetching data: {response.error}")
return pd.DataFrame()
else:
return pd.DataFrame(response.data)
except Exception as e:
st.error(f"An error occurred: {e}")
return pd.DataFrame()
if __name__ == "__main__":
european_data = load_data()
if not european_data.empty:
print("Successfully loaded European data:")
print(european_data.head())
else:
print("Failed to load European data.")