albertmartinez's picture
update sts
77196ea
raw
history blame contribute delete
688 Bytes
import os
import uuid
import shutil
import pandas as pd
import polars as pl
import time
def getDataFrame(path):
data = pd.read_csv(path, on_bad_lines='skip', header=0, sep="\t")
return pl.from_pandas(data)
def save_to_csv(dataframe):
folder_path = "data"
if not dataframe.is_empty():
os.makedirs(folder_path, exist_ok=True)
csv_path = f"{folder_path}/{uuid.uuid4()}.csv"
dataframe.write_csv(csv_path, separator="\t")
return csv_path
def delete_folder_periodically(path, interval=3600):
while True:
if os.path.exists(path):
shutil.rmtree(path)
os.makedirs(path, exist_ok=True)
time.sleep(interval)