module-folder 1.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
File without changes
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
def calculate_average(data):
|
|
2
|
+
"""Returns the mean of a list of numbers."""
|
|
3
|
+
if not data: return 0
|
|
4
|
+
return sum(data) / len(data)
|
|
5
|
+
|
|
6
|
+
def calculate_median(data):
|
|
7
|
+
"""Returns the middle value of a sorted list."""
|
|
8
|
+
if not data: return 0
|
|
9
|
+
sorted_data = sorted(data)
|
|
10
|
+
n = len(sorted_data)
|
|
11
|
+
mid = n // 2
|
|
12
|
+
if n % 2 == 0:
|
|
13
|
+
return (sorted_data[mid - 1] + sorted_data[mid]) / 2
|
|
14
|
+
return sorted_data[mid]
|
|
15
|
+
|
|
16
|
+
def scale_data(data):
|
|
17
|
+
"""Scales numbers between 0 and 1 (Min-Max Scaling)."""
|
|
18
|
+
if not data: return []
|
|
19
|
+
min_val, max_val = min(data), max(data)
|
|
20
|
+
if min_val == max_val: return [0.5 for _ in data]
|
|
21
|
+
return [(x - min_val) / (max_val - min_val) for x in data]
|
|
22
|
+
|
|
23
|
+
def detect_outliers_iqr(data):
|
|
24
|
+
"""Finds outliers in data using the Interquartile Range method."""
|
|
25
|
+
if len(data) < 4: return []
|
|
26
|
+
sorted_data = sorted(data)
|
|
27
|
+
q1, q3 = sorted_data[len(sorted_data)//4], sorted_data[3*len(sorted_data)//4]
|
|
28
|
+
iqr = q3 - q1
|
|
29
|
+
return [x for x in data if x < (q1 - 1.5 * iqr) or x > (q3 + 1.5 * iqr)]
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
def remove_punctuation(text):
|
|
2
|
+
"""Removes basic punctuation marks from a string."""
|
|
3
|
+
# A simple string of characters we want to remove
|
|
4
|
+
bad_chars = "?!.,;"
|
|
5
|
+
|
|
6
|
+
# Loop through each bad character and replace it with nothing
|
|
7
|
+
for char in bad_chars:
|
|
8
|
+
text = text.replace(char, "")
|
|
9
|
+
|
|
10
|
+
return text
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def word_counter(text):
|
|
14
|
+
"""Counts the number of words in a string."""
|
|
15
|
+
# .split() breaks the sentence into a list of words
|
|
16
|
+
words = text.split()
|
|
17
|
+
|
|
18
|
+
# Just count how many items are in that list
|
|
19
|
+
return len(words)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def to_snake_case(text):
|
|
23
|
+
"""Converts a normal sentence into snake_case."""
|
|
24
|
+
# Replace spaces with underscores
|
|
25
|
+
text = text.replace(" ", "_")
|
|
26
|
+
|
|
27
|
+
# Make all letters lowercase
|
|
28
|
+
return text.lower()
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def to_title_case(text):
|
|
32
|
+
"""Capitalizes the first letter of every word."""
|
|
33
|
+
# .title() is a built-in Python function that does this automatically
|
|
34
|
+
return text.title()
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
module_folder/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
module_folder/math_tools.py,sha256=I7P0AhGO0aNf5jL0yXguHOoGMWPK5GSZDZPoj6KunmA,1067
|
|
3
|
+
module_folder/text_tools.py,sha256=4PsYhylgskoVS78Bo4zmxCSgzc5Jt82ZXpy7_PRwa6s,985
|
|
4
|
+
module_folder-1.0.0.dist-info/METADATA,sha256=qyIs6DFHbLbkF5pbQAxpxppLv8mIgshno1ltMEwFuhc,226
|
|
5
|
+
module_folder-1.0.0.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
|
|
6
|
+
module_folder-1.0.0.dist-info/top_level.txt,sha256=xfOjqwQgOPH1rZ2BBd3ndkdky7CxjaPkz3ymqwP_A2Y,14
|
|
7
|
+
module_folder-1.0.0.dist-info/RECORD,,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module_folder
|