i have a Sheet class which contains two attributes and each is a class
- summary (class)
- data (class)
summary and data has 1 attribute,df, which is a dataframe
my question is, am i right to say that since summary and data are classes:
I shouldn't store summary and data directly as dataframes in Sheet class's attribute.
I should store summary and data as objects and when main class wish to set summary/ data, i use Sheet's setter which uses summary/ data's setter to set the actual dataframe
Create sheet object in Main Class :
import Sheet
sheet = Sheet.Sheet() # create empty sheet
sheet.set_summary(new_df) # set summary
sheet.set_data(new_df) # set data
In Sheet Class :
import Summary
import Data
class Sheet:
def __init__(self):
self.name = None
self._summary = Summary.Summary()
self._data = Data.Data()
def get_SheetSummary(self):
return self._summary.get_summary()
def set_SheetSummary(self,new_df):
self._summary.set_summary(new_df)
def get_SheetData(self):
return self._data.get_data()
def set_SheetData(self, new_df):
self._data.set_data(new_df)