pandas-plots 0.0.3__tar.gz → 0.3.1__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.
- {pandas-plots-0.0.3/src/pandas_plots.egg-info → pandas-plots-0.3.1}/PKG-INFO +19 -9
- pandas-plots-0.3.1/README.md +51 -0
- {pandas-plots-0.0.3 → pandas-plots-0.3.1}/pyproject.toml +11 -2
- pandas-plots-0.3.1/src/pandas_plots/sql.py +75 -0
- {pandas-plots-0.0.3 → pandas-plots-0.3.1/src/pandas_plots.egg-info}/PKG-INFO +19 -9
- {pandas-plots-0.0.3 → pandas-plots-0.3.1}/src/pandas_plots.egg-info/SOURCES.txt +1 -0
- {pandas-plots-0.0.3 → pandas-plots-0.3.1}/src/pandas_plots.egg-info/requires.txt +1 -0
- pandas-plots-0.0.3/README.md +0 -50
- {pandas-plots-0.0.3 → pandas-plots-0.3.1}/LICENSE +0 -0
- {pandas-plots-0.0.3 → pandas-plots-0.3.1}/MANIFEST.in +0 -0
- {pandas-plots-0.0.3 → pandas-plots-0.3.1}/setup.cfg +0 -0
- {pandas-plots-0.0.3 → pandas-plots-0.3.1}/src/pandas_plots/__init__.py +0 -0
- {pandas-plots-0.0.3 → pandas-plots-0.3.1}/src/pandas_plots/tbl.py +0 -0
- {pandas-plots-0.0.3 → pandas-plots-0.3.1}/src/pandas_plots/viz.py +0 -0
- {pandas-plots-0.0.3 → pandas-plots-0.3.1}/src/pandas_plots.egg-info/dependency_links.txt +0 -0
- {pandas-plots-0.0.3 → pandas-plots-0.3.1}/src/pandas_plots.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: pandas-plots
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.3.1
|
4
4
|
Summary: A collection of helper for pandas n plots
|
5
5
|
Author-email: smeisegeier <dsexterDSDo@googlemail.com>
|
6
6
|
License: Copyright 2024 smeisegeier
|
@@ -11,10 +11,18 @@ License: Copyright 2024 smeisegeier
|
|
11
11
|
|
12
12
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
13
13
|
|
14
|
-
Project-URL:
|
14
|
+
Project-URL: homepage, https://github.com/smeisegeier/pandas-plots
|
15
|
+
Project-URL: repository, https://github.com/smeisegeier/pandas-plots
|
15
16
|
Keywords: tables,pivot,plotly
|
16
17
|
Classifier: License :: OSI Approved :: MIT License
|
17
18
|
Classifier: Programming Language :: Python :: 3
|
19
|
+
Classifier: Programming Language :: Python :: 3.10
|
20
|
+
Classifier: Development Status :: 5 - Production/Stable
|
21
|
+
Classifier: Development Status :: 3 - Alpha
|
22
|
+
Classifier: Environment :: Console
|
23
|
+
Classifier: Intended Audience :: Science/Research
|
24
|
+
Classifier: Operating System :: OS Independent
|
25
|
+
Classifier: Topic :: Scientific/Engineering
|
18
26
|
Requires-Python: >=3.10
|
19
27
|
Description-Content-Type: text/markdown
|
20
28
|
License-File: LICENSE
|
@@ -22,15 +30,13 @@ Requires-Dist: pandas>=2.0.0
|
|
22
30
|
Requires-Dist: plotly
|
23
31
|
Requires-Dist: matplotlib
|
24
32
|
Requires-Dist: seaborn
|
33
|
+
Requires-Dist: sqlalchemy<2.0.0
|
25
34
|
|
26
35
|
# pandas-plots
|
27
36
|
|
28
|
-
|
29
|
-
<!-- [](https://GitHub.com/Naereen/StrapDown.js/commit/) -->
|
37
|
+
   
|
30
38
|
|
31
|
-
|
32
|
-
|
33
|
-
## quickstart
|
39
|
+
## usage
|
34
40
|
|
35
41
|
install / update package
|
36
42
|
|
@@ -44,7 +50,7 @@ include in python
|
|
44
50
|
from pandas_plots import tbl, viz
|
45
51
|
```
|
46
52
|
|
47
|
-
example
|
53
|
+
## example
|
48
54
|
|
49
55
|
```python
|
50
56
|
# load sample dataset from seaborn
|
@@ -53,7 +59,8 @@ df = sb.load_dataset('taxis')
|
|
53
59
|
|
54
60
|
viz.plot_box(df['fare'], height=400, violin=True)
|
55
61
|
```
|
56
|
-
|
62
|
+
|
63
|
+

|
57
64
|
|
58
65
|
## why use pandas-plots
|
59
66
|
|
@@ -72,4 +79,7 @@ It is subdivided into:
|
|
72
79
|
- `plot_stacked_bars()` shortcut to stacked bars 😄
|
73
80
|
- `plot_quadrants()` quickly show a 2x2 heatmap
|
74
81
|
|
82
|
+
- `sql` is added as convienient wrapper for fetching data from sql databases
|
83
|
+
- `connect_sql` get data from `['mssql', 'sqlite','postgres']`
|
84
|
+
|
75
85
|
## dependencies
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# pandas-plots
|
2
|
+
|
3
|
+
   
|
4
|
+
|
5
|
+
## usage
|
6
|
+
|
7
|
+
install / update package
|
8
|
+
|
9
|
+
```bash
|
10
|
+
pip install pandas-plots -U
|
11
|
+
```
|
12
|
+
|
13
|
+
include in python
|
14
|
+
|
15
|
+
```python
|
16
|
+
from pandas_plots import tbl, viz
|
17
|
+
```
|
18
|
+
|
19
|
+
## example
|
20
|
+
|
21
|
+
```python
|
22
|
+
# load sample dataset from seaborn
|
23
|
+
import seaborn as sb
|
24
|
+
df = sb.load_dataset('taxis')
|
25
|
+
|
26
|
+
viz.plot_box(df['fare'], height=400, violin=True)
|
27
|
+
```
|
28
|
+
|
29
|
+

|
30
|
+
|
31
|
+
## why use pandas-plots
|
32
|
+
|
33
|
+
`pandas-plots` is a package to help you examine and visualize data that are organized in a pandas DataFrame. It provides a high level api to pandas / plotly with some selected functions.
|
34
|
+
|
35
|
+
It is subdivided into:
|
36
|
+
|
37
|
+
- `tbl` utilities for table descriptions
|
38
|
+
- `describe_df()` an alternative version of pandas `describe()` function
|
39
|
+
- `pivot_df()` gets a pivot table of a 3 column dataframe
|
40
|
+
|
41
|
+
- `viz` utilities for plotly visualizations
|
42
|
+
- `plot_box()` auto annotated boxplot w/ violin option
|
43
|
+
- `plot_boxes()` multiple boxplots _(annotation is experimental)_
|
44
|
+
- `plots_bars()` a standardized bar plot
|
45
|
+
- `plot_stacked_bars()` shortcut to stacked bars 😄
|
46
|
+
- `plot_quadrants()` quickly show a 2x2 heatmap
|
47
|
+
|
48
|
+
- `sql` is added as convienient wrapper for fetching data from sql databases
|
49
|
+
- `connect_sql` get data from `['mssql', 'sqlite','postgres']`
|
50
|
+
|
51
|
+
## dependencies
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
4
4
|
|
5
5
|
[project]
|
6
6
|
name = "pandas-plots"
|
7
|
-
version = "0.
|
7
|
+
version = "0.3.1"
|
8
8
|
requires-python = ">=3.10"
|
9
9
|
description = "A collection of helper for pandas n plots"
|
10
10
|
readme = "README.md"
|
@@ -13,6 +13,13 @@ license = { file = "LICENSE" }
|
|
13
13
|
classifiers = [
|
14
14
|
"License :: OSI Approved :: MIT License",
|
15
15
|
"Programming Language :: Python :: 3",
|
16
|
+
"Programming Language :: Python :: 3.10",
|
17
|
+
'Development Status :: 5 - Production/Stable',
|
18
|
+
'Development Status :: 3 - Alpha',
|
19
|
+
'Environment :: Console',
|
20
|
+
'Intended Audience :: Science/Research',
|
21
|
+
'Operating System :: OS Independent',
|
22
|
+
'Topic :: Scientific/Engineering'
|
16
23
|
]
|
17
24
|
keywords = ["tables", "pivot", "plotly"]
|
18
25
|
dependencies = [
|
@@ -20,13 +27,15 @@ dependencies = [
|
|
20
27
|
"plotly",
|
21
28
|
"matplotlib",
|
22
29
|
"seaborn",
|
30
|
+
"sqlalchemy < 2.0.0",
|
23
31
|
]
|
24
32
|
|
25
33
|
# [project.optional-dependencies]
|
26
34
|
# dev = ["black", "bumpver", "isort", "pip-tools", "pytest"]
|
27
35
|
|
28
36
|
[project.urls]
|
29
|
-
|
37
|
+
homepage = "https://github.com/smeisegeier/pandas-plots"
|
38
|
+
repository = "https://github.com/smeisegeier/pandas-plots"
|
30
39
|
|
31
40
|
# [project.scripts]
|
32
41
|
# realpython = "reader.__main__:main"
|
@@ -0,0 +1,75 @@
|
|
1
|
+
from typing import Literal
|
2
|
+
|
3
|
+
from sqlalchemy import create_engine, text
|
4
|
+
from sqlalchemy_utils import create_database, database_exists
|
5
|
+
|
6
|
+
|
7
|
+
def connect_sql(
|
8
|
+
db: str,
|
9
|
+
host: str = '',
|
10
|
+
user: str = '',
|
11
|
+
pw: str = '',
|
12
|
+
dbms: Literal['mssql', 'sqlite','postgres'] = 'mssql',
|
13
|
+
ensure_db_exists: bool = False,
|
14
|
+
) -> object:
|
15
|
+
"""
|
16
|
+
Connects to any SQL database based on the given parameters.
|
17
|
+
|
18
|
+
Args:
|
19
|
+
db (str): The name of the database / sqlite-file.
|
20
|
+
host (str, optional): The host name or IP address of the database server. Defaults to an empty string.
|
21
|
+
user (str, optional): The username for authentication. Defaults to an empty string.
|
22
|
+
pw (str, optional): The password for authentication. Defaults to an empty string.
|
23
|
+
dbms (Literal['mssql', 'sqlite','postgres'], optional): The type of database management system. Defaults to 'mssql'.
|
24
|
+
ensure_db_exists (bool, optional): Specifies whether to create the database if it does not exist. Defaults to False.
|
25
|
+
|
26
|
+
Returns:
|
27
|
+
Connection: The connection object for the established database connection.
|
28
|
+
|
29
|
+
Remarks:
|
30
|
+
- postgres
|
31
|
+
- psycopg2-binary must be installed
|
32
|
+
- example:
|
33
|
+
con = my_connect_to_any_sql(
|
34
|
+
host='<instance>.postgres.database.azure.com',
|
35
|
+
db='eteste',
|
36
|
+
user='<user>n@<instance>',
|
37
|
+
pw='<password>',
|
38
|
+
dbms='postgres',
|
39
|
+
ensure_db_exists=False
|
40
|
+
)
|
41
|
+
- mssql
|
42
|
+
- sqlalchemy nust be <v2 to write -> sql
|
43
|
+
|
44
|
+
"""
|
45
|
+
|
46
|
+
if dbms == 'mssql':
|
47
|
+
url = f'mssql://{user}:{pw}@{host}/{db}?driver=ODBC Driver 17 for SQL Server'
|
48
|
+
elif dbms == 'sqlite':
|
49
|
+
url = f'sqlite:///{db}'
|
50
|
+
elif dbms == 'postgres':
|
51
|
+
url = f'postgresql+psycopg2://{user}:{pw}@{host}/{db}'
|
52
|
+
else:
|
53
|
+
print("dbms not supported")
|
54
|
+
return None
|
55
|
+
|
56
|
+
engine = create_engine(
|
57
|
+
url, # * leave positional argument unnamed, since it was relabeled between versions..
|
58
|
+
connect_args={'connect_timeout': 10},
|
59
|
+
)
|
60
|
+
|
61
|
+
# * ensure db exists
|
62
|
+
if ensure_db_exists:
|
63
|
+
if not database_exists(engine.url):
|
64
|
+
create_database(engine.url)
|
65
|
+
print(f'db {db} created')
|
66
|
+
else:
|
67
|
+
print(f'db {db} exists')
|
68
|
+
|
69
|
+
# * now connect
|
70
|
+
try:
|
71
|
+
con=engine.connect()
|
72
|
+
except Exception as e:
|
73
|
+
print(e)
|
74
|
+
|
75
|
+
return con
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: pandas-plots
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.3.1
|
4
4
|
Summary: A collection of helper for pandas n plots
|
5
5
|
Author-email: smeisegeier <dsexterDSDo@googlemail.com>
|
6
6
|
License: Copyright 2024 smeisegeier
|
@@ -11,10 +11,18 @@ License: Copyright 2024 smeisegeier
|
|
11
11
|
|
12
12
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
13
13
|
|
14
|
-
Project-URL:
|
14
|
+
Project-URL: homepage, https://github.com/smeisegeier/pandas-plots
|
15
|
+
Project-URL: repository, https://github.com/smeisegeier/pandas-plots
|
15
16
|
Keywords: tables,pivot,plotly
|
16
17
|
Classifier: License :: OSI Approved :: MIT License
|
17
18
|
Classifier: Programming Language :: Python :: 3
|
19
|
+
Classifier: Programming Language :: Python :: 3.10
|
20
|
+
Classifier: Development Status :: 5 - Production/Stable
|
21
|
+
Classifier: Development Status :: 3 - Alpha
|
22
|
+
Classifier: Environment :: Console
|
23
|
+
Classifier: Intended Audience :: Science/Research
|
24
|
+
Classifier: Operating System :: OS Independent
|
25
|
+
Classifier: Topic :: Scientific/Engineering
|
18
26
|
Requires-Python: >=3.10
|
19
27
|
Description-Content-Type: text/markdown
|
20
28
|
License-File: LICENSE
|
@@ -22,15 +30,13 @@ Requires-Dist: pandas>=2.0.0
|
|
22
30
|
Requires-Dist: plotly
|
23
31
|
Requires-Dist: matplotlib
|
24
32
|
Requires-Dist: seaborn
|
33
|
+
Requires-Dist: sqlalchemy<2.0.0
|
25
34
|
|
26
35
|
# pandas-plots
|
27
36
|
|
28
|
-
|
29
|
-
<!-- [](https://GitHub.com/Naereen/StrapDown.js/commit/) -->
|
37
|
+
   
|
30
38
|
|
31
|
-
|
32
|
-
|
33
|
-
## quickstart
|
39
|
+
## usage
|
34
40
|
|
35
41
|
install / update package
|
36
42
|
|
@@ -44,7 +50,7 @@ include in python
|
|
44
50
|
from pandas_plots import tbl, viz
|
45
51
|
```
|
46
52
|
|
47
|
-
example
|
53
|
+
## example
|
48
54
|
|
49
55
|
```python
|
50
56
|
# load sample dataset from seaborn
|
@@ -53,7 +59,8 @@ df = sb.load_dataset('taxis')
|
|
53
59
|
|
54
60
|
viz.plot_box(df['fare'], height=400, violin=True)
|
55
61
|
```
|
56
|
-
|
62
|
+
|
63
|
+

|
57
64
|
|
58
65
|
## why use pandas-plots
|
59
66
|
|
@@ -72,4 +79,7 @@ It is subdivided into:
|
|
72
79
|
- `plot_stacked_bars()` shortcut to stacked bars 😄
|
73
80
|
- `plot_quadrants()` quickly show a 2x2 heatmap
|
74
81
|
|
82
|
+
- `sql` is added as convienient wrapper for fetching data from sql databases
|
83
|
+
- `connect_sql` get data from `['mssql', 'sqlite','postgres']`
|
84
|
+
|
75
85
|
## dependencies
|
pandas-plots-0.0.3/README.md
DELETED
@@ -1,50 +0,0 @@
|
|
1
|
-
# pandas-plots
|
2
|
-
|
3
|
-
<!-- [](https://GitHub.com/Naereen/StrapDown.js/releases/) -->
|
4
|
-
<!-- [](https://GitHub.com/Naereen/StrapDown.js/commit/) -->
|
5
|
-
|
6
|
-

|
7
|
-
|
8
|
-
## quickstart
|
9
|
-
|
10
|
-
install / update package
|
11
|
-
|
12
|
-
```bash
|
13
|
-
pip install pandas-plots -U
|
14
|
-
```
|
15
|
-
|
16
|
-
include in python
|
17
|
-
|
18
|
-
```python
|
19
|
-
from pandas_plots import tbl, viz
|
20
|
-
```
|
21
|
-
|
22
|
-
example
|
23
|
-
|
24
|
-
```python
|
25
|
-
# load sample dataset from seaborn
|
26
|
-
import seaborn as sb
|
27
|
-
df = sb.load_dataset('taxis')
|
28
|
-
|
29
|
-
viz.plot_box(df['fare'], height=400, violin=True)
|
30
|
-
```
|
31
|
-

|
32
|
-
|
33
|
-
## why use pandas-plots
|
34
|
-
|
35
|
-
`pandas-plots` is a package to help you examine and visualize data that are organized in a pandas DataFrame. It provides a high level api to pandas / plotly with some selected functions.
|
36
|
-
|
37
|
-
It is subdivided into:
|
38
|
-
|
39
|
-
- `tbl` utilities for table descriptions
|
40
|
-
- `describe_df()` an alternative version of pandas `describe()` function
|
41
|
-
- `pivot_df()` gets a pivot table of a 3 column dataframe
|
42
|
-
|
43
|
-
- `viz` utilities for plotly visualizations
|
44
|
-
- `plot_box()` auto annotated boxplot w/ violin option
|
45
|
-
- `plot_boxes()` multiple boxplots _(annotation is experimental)_
|
46
|
-
- `plots_bars()` a standardized bar plot
|
47
|
-
- `plot_stacked_bars()` shortcut to stacked bars 😄
|
48
|
-
- `plot_quadrants()` quickly show a 2x2 heatmap
|
49
|
-
|
50
|
-
## dependencies
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|