mirror of
https://github.com/corca-ai/EVAL
synced 2024-10-30 09:20:44 +00:00
3ec0cc786c
* refactor: api, core * feat: static uploader * doc: update readme * fix: mkdir static file * doc: typo
22 lines
595 B
Python
22 lines
595 B
Python
import pandas as pd
|
|
|
|
from core.prompts.file import DATAFRAME_PROMPT
|
|
|
|
from .base import BaseHandler
|
|
|
|
|
|
class CsvToDataframe(BaseHandler):
|
|
def handle(self, filename: str):
|
|
df = pd.read_csv(filename)
|
|
description = (
|
|
f"Dataframe with {len(df)} rows and {len(df.columns)} columns."
|
|
"Columns are: "
|
|
f"{', '.join(df.columns)}"
|
|
)
|
|
|
|
print(
|
|
f"\nProcessed CsvToDataframe, Input CSV: {filename}, Output Description: {description}"
|
|
)
|
|
|
|
return DATAFRAME_PROMPT.format(filename=filename, description=description)
|