chtoolbox 0.2.1__tar.gz → 0.2.3__tar.gz
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.
- {chtoolbox-0.2.1 → chtoolbox-0.2.3}/PKG-INFO +1 -1
- {chtoolbox-0.2.1 → chtoolbox-0.2.3}/chtoolbox/misc.py +19 -3
- {chtoolbox-0.2.1 → chtoolbox-0.2.3}/chtoolbox.egg-info/PKG-INFO +1 -1
- {chtoolbox-0.2.1 → chtoolbox-0.2.3}/setup.py +1 -1
- {chtoolbox-0.2.1 → chtoolbox-0.2.3}/LICENSE +0 -0
- {chtoolbox-0.2.1 → chtoolbox-0.2.3}/README.md +0 -0
- {chtoolbox-0.2.1 → chtoolbox-0.2.3}/chtoolbox/__init__.py +0 -0
- {chtoolbox-0.2.1 → chtoolbox-0.2.3}/chtoolbox.egg-info/SOURCES.txt +0 -0
- {chtoolbox-0.2.1 → chtoolbox-0.2.3}/chtoolbox.egg-info/dependency_links.txt +0 -0
- {chtoolbox-0.2.1 → chtoolbox-0.2.3}/chtoolbox.egg-info/requires.txt +0 -0
- {chtoolbox-0.2.1 → chtoolbox-0.2.3}/chtoolbox.egg-info/top_level.txt +0 -0
- {chtoolbox-0.2.1 → chtoolbox-0.2.3}/setup.cfg +0 -0
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import pandas as pd
|
|
2
2
|
|
|
3
|
-
def clipboard_to_dict():
|
|
3
|
+
def clipboard_to_dict(print_dict=True):
|
|
4
4
|
"""
|
|
5
5
|
Converts clipboard content to a dictionary.
|
|
6
|
+
If print_dict is True, the dictionary is printed.
|
|
6
7
|
This function reads the clipboard content into a pandas DataFrame and converts it to a dictionary.
|
|
7
8
|
If the DataFrame has two columns, it converts it to a flat dictionary.
|
|
8
9
|
If the DataFrame has more than two columns, it converts it to a nested dictionary with 'index' orientation.
|
|
@@ -48,11 +49,14 @@ def clipboard_to_dict():
|
|
|
48
49
|
df = df[1:]
|
|
49
50
|
|
|
50
51
|
# Set the first column as the index
|
|
51
|
-
df.set_index(
|
|
52
|
+
df.set_index(df.columns[0], inplace=True)
|
|
52
53
|
|
|
53
54
|
# Convert the DataFrame to a nested dictionary with 'index' orientation
|
|
54
55
|
dictionary = df.to_dict(orient='index')
|
|
55
56
|
|
|
57
|
+
if print_dict:
|
|
58
|
+
print(dictionary)
|
|
59
|
+
|
|
56
60
|
return dictionary
|
|
57
61
|
|
|
58
62
|
|
|
@@ -117,4 +121,16 @@ def compare_lists_from_clipboard():
|
|
|
117
121
|
unique_items.append(value)
|
|
118
122
|
|
|
119
123
|
# Print the resulting dictionary
|
|
120
|
-
return list_dict, unique_items, list(common_items)
|
|
124
|
+
return list_dict, unique_items, list(common_items)
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
def add_two_numbers(a,b):
|
|
128
|
+
"""
|
|
129
|
+
Add two numbers together.
|
|
130
|
+
Args:
|
|
131
|
+
a (int): The first number.
|
|
132
|
+
b (int): The second number.
|
|
133
|
+
Returns:
|
|
134
|
+
int: The sum of the two numbers.
|
|
135
|
+
"""
|
|
136
|
+
return a + b
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|