tableskill 0.3.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.
tableskill/__init__.py ADDED
@@ -0,0 +1 @@
1
+ from tableskill.tableskill import tableskill
@@ -0,0 +1,120 @@
1
+ # Standard library
2
+ from datetime import date
3
+ import os
4
+
5
+ # Third party packages
6
+ import polars as pl
7
+
8
+ # Local modules
9
+
10
+ ### FUNCTION -----------------------------------------------------------------------------------------------------------
11
+
12
+
13
+ def tableskill(
14
+ dataframe_dict: dict[str, pl.DataFrame] = {"dataframe_name": pl.DataFrame()},
15
+ *,
16
+ sub_folder_in_export: str = "",
17
+ test_mode: bool = False,
18
+ ) -> str:
19
+ """
20
+ Converts a dictionary of Polars dataframes into csv files suitable for visualization in TableSkill.
21
+ (https://www.tableskill.com/)
22
+
23
+ Parameters
24
+ ----------
25
+ dataframe_dict : dict[str, pl.DataFrame`]
26
+ Dictionary with DataFrames to export
27
+
28
+ sub_folder_in_export : str
29
+ sub_folder when exporting (optional)
30
+
31
+ Returns
32
+ -------
33
+ pathstring : str
34
+ string of path where flat files were exported
35
+
36
+ """
37
+
38
+ ### SET CONSTANTS ------------------------------------------------------------------------------------------------------
39
+ if "USERPRINCIPALNAME" in os.environ:
40
+ user_surname = os.environ["USERPRINCIPALNAME"].split(".")[1].split("@")[0]
41
+ else:
42
+ user_surname = "DOE"
43
+
44
+ # Note sure who/what sets USERPRINCIPALNAME (email address), but here used to filter out surname
45
+ # user_surname = os.environ["USERPRINCIPALNAME"].split(".")[1].split("@")[0]
46
+ os.environ["USER_SURNAME"] = user_surname
47
+
48
+ export_folder = os.path.join(
49
+ # Path of home directory
50
+ os.path.expanduser("~"),
51
+ # environment variable USER_SURNAME, if it exists, otherwise empty string
52
+ os.environ.get("USER_SURNAME", ""),
53
+ # os.environ.get("USER_SURNAME", "Levy"),
54
+ # partial path
55
+ os.path.normpath("temp/tableskill"),
56
+ # Today's date as string with format yyyymmdd
57
+ date.today().strftime("%Y%m%d"),
58
+ os.path.normpath(sub_folder_in_export),
59
+ )
60
+
61
+ ### EXPORT DATAFRAMES TO FLAT FILES ------------------------------------------------------------------------------------
62
+ if not os.path.exists(export_folder):
63
+ os.makedirs(export_folder)
64
+
65
+ for key, value in dataframe_dict.items():
66
+ # print("key = ", key, " and value = ", value)
67
+ export_filename = key
68
+ export_filename_suffix = ".csv"
69
+ export_filepath = os.path.join(
70
+ export_folder, export_filename + export_filename_suffix
71
+ )
72
+ # print("export_filpath = ", export_filepath)
73
+ value.write_csv(export_filepath)
74
+
75
+ ### RETURN VALUE -------------------------------------------------------------------------------------------------------
76
+
77
+ # if test_mode:
78
+
79
+ return export_folder
80
+ # pass
81
+
82
+
83
+ ### TEST ---------------------------------------------------------------------------------------------------------------
84
+ if __name__ == "__main__":
85
+
86
+ from datetime import datetime
87
+
88
+ # Create two dataframes from scratch
89
+ my_df1 = pl.DataFrame(
90
+ {
91
+ "integer": [1, 2, 3],
92
+ "date": [
93
+ datetime(2025, 1, 1),
94
+ datetime(2025, 1, 2),
95
+ datetime(2025, 1, 3),
96
+ ],
97
+ "float": [4.1, 5.2, 6.3],
98
+ "string": ["a", "b", "c"],
99
+ }
100
+ )
101
+
102
+ my_df2 = pl.DataFrame(
103
+ {
104
+ "an_integer": range(10),
105
+ }
106
+ )
107
+
108
+ # Define a dictionary for the 2 dataframes
109
+ my_dataframe_dict = {
110
+ "1 my_df1": my_df1,
111
+ "2 my_df2": my_df2,
112
+ }
113
+
114
+ # Export the dataframes to tableskill using the function defined here
115
+ test_call = tableskill(
116
+ dataframe_dict=my_dataframe_dict,
117
+ sub_folder_in_export="tableskill",
118
+ )
119
+
120
+ print("test_call = ", test_call)
@@ -0,0 +1,92 @@
1
+ Metadata-Version: 2.4
2
+ Name: tableskill
3
+ Version: 0.3.0
4
+ Summary: A Python package to visualize tabular data via https://www.tableskill.com/
5
+ Author-email: Walter Levy <klwlevy@hotmail.com>
6
+ License: MIT License
7
+
8
+ Copyright (c) 2026 Walter Levy <klwlevy@hotmail.com> and contributors
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+ Project-URL: Repository, https://github.com/klwlevy/tableskill.git
28
+ Classifier: Programming Language :: Python
29
+ Requires-Python: >=3.11
30
+ Description-Content-Type: text/markdown
31
+ License-File: LICENSE
32
+ Requires-Dist: polars>=1.0
33
+ Provides-Extra: docs
34
+ Requires-Dist: mkdocs; extra == "docs"
35
+ Requires-Dist: mkdocs-material; extra == "docs"
36
+ Requires-Dist: mkdocstrings-python; extra == "docs"
37
+ Provides-Extra: dev
38
+ Requires-Dist: tableskill[docs]; extra == "dev"
39
+ Requires-Dist: black; extra == "dev"
40
+ Dynamic: license-file
41
+
42
+ # TableSkill
43
+
44
+ Python package for visualization of tabular data via https://www.tableskill.com/
45
+ Specifically, polars (https://pola.rs/) dataframes are supported.
46
+
47
+ # Usage:
48
+
49
+ You can comfortably visualize your polars dataframes in tableskill as in this self-contained example:
50
+ ```python
51
+
52
+ import tableskill as ts
53
+ import polars as pl
54
+
55
+ from datetime import datetime
56
+
57
+ # Create two dataframes from scratch
58
+ my_df1 = pl.DataFrame(
59
+ {
60
+ "integer": [1, 2, 3],
61
+ "date": [
62
+ datetime(2025, 1, 1),
63
+ datetime(2025, 1, 2),
64
+ datetime(2025, 1, 3),
65
+ ],
66
+ "float": [4.1, 5.2, 6.3],
67
+ "string": ["a", "b", "c"],
68
+ }
69
+ )
70
+
71
+ my_df2 = pl.DataFrame(
72
+ {
73
+ "an_integer": range(10),
74
+ }
75
+ )
76
+
77
+ # Define a dictionary for the 2 dataframes
78
+ my_dataframe_dict = {
79
+ "1 my_df": my_df1,
80
+ "2 my_df": my_df2,
81
+ }
82
+
83
+ # Export the dataframes to tableskill using the tableskill function
84
+ ts.tableskill(
85
+ dataframe_dict = my_dataframe_dict,
86
+ sub_folder_in_export = "tableskill_sample",
87
+ )
88
+ ```
89
+
90
+ The above will generate flat files suitable for https://www.tableskill.com/ on your hard drive under
91
+ `~\<LAST_NAME>\temp\tableskill\<YYYYMMDD>\tableskill_sample\`
92
+ You can simply drag invidual files or an entire folder structure into TableSkill.
@@ -0,0 +1,7 @@
1
+ tableskill/__init__.py,sha256=hsUOACjRNuztrwoKV9NVlujb_ecX6M8gnzIT6gXSNCE,44
2
+ tableskill/tableskill.py,sha256=wTIO_E-0X7X0c3mnoOjax8gvi7NoFYAfbQegmhp6jyg,3660
3
+ tableskill-0.3.0.dist-info/licenses/LICENSE,sha256=VuxjVcIAhQ51F06nTYKkGwfPzG30kUiiiAnY5bkJvgo,1106
4
+ tableskill-0.3.0.dist-info/METADATA,sha256=HLtXoqbaSDMPz4Cq9jg7gOAOczbS37MhcT-kfGut2WE,3252
5
+ tableskill-0.3.0.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
6
+ tableskill-0.3.0.dist-info/top_level.txt,sha256=V41pGWwoOhVWR6VQ9ayIi5YcFphvPcSkW6xDAgmDpmw,11
7
+ tableskill-0.3.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (82.0.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Walter Levy <klwlevy@hotmail.com> and contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1 @@
1
+ tableskill