Spaces:
Sleeping
Sleeping
Commit ·
62b003e
1
Parent(s): be9fa47
updated the smolagents
Browse files4 unmodified lines56789101112131415161718192021222324252627282930313226 unmodified lines5960616263646566676869707172734 unmodified lines@tooldef clean_data(df: pd.DataFrame) -> pd.DataFrame:"""Clean the DataFrame by stripping whitespace from column names and dropping rows that are completely empty.Args:df (pd.DataFrame): The input DataFrame containing the raw data.Returns:pd.DataFrame: A cleaned DataFrame with stripped column names and without completely empty rows."""df.columns = df.columns.str.strip()df = df.dropna(how="all")return df@tooldef extract_features(df: pd.DataFrame) -> pd.DataFrame:"""Dynamically extract features from the DataFrame.Args:df (pd.DataFrame): The input DataFrame containing the raw data.Returns:pd.DataFrame: The DataFrame updated with new dynamically engineered features."""# Numeric columns: log transformationnumeric_cols = df.select_dtypes(include=[np.number]).columns.to_list()for col in numeric_cols:26 unmodified lines@tooldef save_to_csv(df: pd.DataFrame, filename: str = "output.csv") -> str:"""Save the DataFrame to a CSV file.Args:df (pd.DataFrame): The DataFrame to save.filename (str): The name of the output CSV file (default "output.csv").Returns:str: The file path of the saved CSV."""df.to_csv(filename, index=False)return filename4 unmodified lines5678910111213141516171826 unmodified lines454647484950514 unmodified lines@tooldef clean_data(df: pd.DataFrame) -> pd.DataFrame:"""Clean the input DataFrame (df) by stripping column whitespace and dropping empty rows."""df.columns = df.columns.str.strip()df = df.dropna(how="all")return df@tooldef extract_features(df: pd.DataFrame) -> pd.DataFrame:"""Dynamically extract features from the input DataFrame (df)."""# Numeric columns: log transformationnumeric_cols = df.select_dtypes(include=[np.number]).columns.to_list()for col in numeric_cols:26 unmodified lines@tooldef save_to_csv(df: pd.DataFrame, filename: str = "output.csv") -> str:"""Save the input DataFrame (df) to a CSV file named 'filename'."""df.to_csv(filename, index=False)return filename
Oracle/DataSmolAgent.py+3-25