Make Data class derive from pandas.DataFrame
This will simplify the usage of class Data in method TimePane.add_data
.
This is a possible code:
import pandas as pd
class Data(pd.DataFrame):
def __init__(self, filename, file_format, current_format):
super().__init__(pd.read_csv(filename, sep=None, engine="python"))
self.update_format(file_format, current_format)
def update_format(self, file_format, current_format):
for fmt in range(file_format + 1, current_format + 1):
if fmt == 2:
pass
if fmt == 3:
self.rename(columns={"label": "event"}, inplace=True)