21
21
22
22
23
23
def __create_general_modality_plot (df ):
24
+ """
25
+ Create a bar plot to visualize the frequency of general modalities.
26
+
27
+ This function takes a pandas DataFrame as input and generates a bar plot to display the frequency
28
+ of different general modalities in the 'generalmodality' column of the DataFrame.
29
+
30
+ Parameters:
31
+ df (pandas.DataFrame): The input DataFrame containing the 'generalmodality' column.
32
+
33
+ Returns:
34
+ None: The function generates a bar plot but does not return any value. The plot is saved as an
35
+ image file with a filename in the format 'general-modality-YYYYMMDD.png', where 'YYYYMMDD'
36
+ represents the current date in year-month-day format.
37
+ """
38
+
24
39
modality_counts = df ["generalmodality" ].value_counts ()
25
40
26
41
plt .figure (figsize = (10 , 6 ))
@@ -123,11 +138,22 @@ def __create_general_modality_treemap(df):
123
138
124
139
def __get_pretty_size_statistics (df ):
125
140
"""
126
- Pretty version of __get_size_statistics
141
+ Get human-readable size statistics from the DataFrame.
127
142
128
- Input: dataframe
129
- Output: list of strings
143
+ This method takes a pandas DataFrame as input and calculates size statistics using the '__get_size_statistics()'
144
+ method. The statistics include the minimum, maximum, mean, and total size of the data in the DataFrame.
145
+
146
+ Parameters:
147
+ df (pandas.DataFrame): The input DataFrame.
148
+
149
+ Returns:
150
+ list: A list containing human-readable size statistics in the following order:
151
+ - Human-readable minimum size.
152
+ - Human-readable maximum size.
153
+ - Human-readable mean size.
154
+ - Human-readable total size.
130
155
"""
156
+
131
157
size_stats = __get_size_statistics (df )
132
158
133
159
return [
@@ -140,10 +166,20 @@ def __get_pretty_size_statistics(df):
140
166
141
167
def __get_size_statistics (df ):
142
168
"""
143
- Helper method that returns size statistics from size column .
169
+ Calculate basic size statistics from the DataFrame .
144
170
145
- Input: dataframe
146
- Output: list of numbers
171
+ This method takes a pandas DataFrame as input and calculates basic size statistics, including the minimum,
172
+ maximum, mean, and standard deviation of the 'size' column in the DataFrame.
173
+
174
+ Parameters:
175
+ df (pandas.DataFrame): The input DataFrame containing the 'size' column.
176
+
177
+ Returns:
178
+ list: A list containing the size statistics in the following order:
179
+ - Minimum size.
180
+ - Maximum size.
181
+ - Mean size.
182
+ - Standard deviation of sizes.
147
183
"""
148
184
149
185
min = df ["size" ].min ()
0 commit comments