adds docstrings
This commit is contained in:
@@ -18,13 +18,24 @@ class BasePlotlyAnalysis(BaseAnalysis, ABC):
|
||||
- Transformation
|
||||
- Plot generation
|
||||
- Memory cleanup
|
||||
|
||||
Attributes:
|
||||
plot_filename (str): The filename for the output plot.
|
||||
alt_text (str): The alt text for the plot.
|
||||
"""
|
||||
|
||||
plot_filename = "default_plot.html"
|
||||
alt_text = "Default Alt Text"
|
||||
|
||||
def execute(self, df: pd.DataFrame):
|
||||
"""Executes the full analysis pipeline"""
|
||||
"""
|
||||
Executes the full analysis pipeline.
|
||||
|
||||
Parameters:
|
||||
df (pd.DataFrame): The input DataFrame containing user activity data.
|
||||
|
||||
Returns:
|
||||
str: HTML iframe containing the URL to the generated plot.
|
||||
"""
|
||||
df = prepare_data(df) # Step 1: Prepare data
|
||||
|
||||
paths = mk_plotdir(self.plot_filename)
|
||||
@@ -41,10 +52,23 @@ class BasePlotlyAnalysis(BaseAnalysis, ABC):
|
||||
|
||||
@abstractmethod
|
||||
def transform_data(self, df: pd.DataFrame) -> pd.DataFrame:
|
||||
"""Subclasses must define how they transform the data"""
|
||||
"""
|
||||
Subclasses must define how they transform the data.
|
||||
|
||||
Parameters:
|
||||
df (pd.DataFrame): The input DataFrame containing user activity data.
|
||||
|
||||
Returns:
|
||||
pd.DataFrame: The transformed DataFrame.
|
||||
"""
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def plot_data(self, df: pd.DataFrame):
|
||||
"""Subclasses must define how they generate the plot"""
|
||||
"""
|
||||
Subclasses must define how they generate the plot.
|
||||
|
||||
Parameters:
|
||||
df (pd.DataFrame): The transformed DataFrame containing data to be plotted.
|
||||
"""
|
||||
pass
|
||||
Reference in New Issue
Block a user