chtoolbox 0.2.1__tar.gz → 0.2.2__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.
@@ -1,4 +1,4 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: chtoolbox
3
- Version: 0.2.1
3
+ Version: 0.2.2
4
4
  License-File: LICENSE
@@ -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('idx', inplace=True)
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
 
@@ -1,4 +1,4 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: chtoolbox
3
- Version: 0.2.1
3
+ Version: 0.2.2
4
4
  License-File: LICENSE
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name='chtoolbox',
5
- version='0.2.1',
5
+ version='0.2.2',
6
6
  packages=find_packages(),
7
7
  install_requires=[
8
8
  'numpy',
File without changes
File without changes
File without changes