2024-06-08 03:00:08 +08:00
|
|
|
import pandas as pd
|
|
|
|
import numpy as np
|
|
|
|
|
|
|
|
class Data_Read:
|
|
|
|
def __init__(self, file_path, suffix) -> None:
|
|
|
|
self.file_path = file_path
|
|
|
|
if suffix == "csv":
|
|
|
|
self.data_frame = pd.read_csv(self.file_path)
|
|
|
|
elif suffix == "xls" or suffix == "xlsx":
|
|
|
|
self.data_frame = pd.read_excel(self.file_path)
|
|
|
|
|
|
|
|
def get_head_data(self, n : int):
|
|
|
|
return self.data_frame.head(n)
|
|
|
|
|
|
|
|
|
|
|
|
|