-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
355 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
from grplot.features.filter.filter_def import filter_def | ||
from grplot.utils.arg_ax_type import arg_ax_type | ||
|
||
def check_filter(df, logic, axes): | ||
logic = arg_ax_type(arg=logic, axes=axes) | ||
# check logic | ||
if logic is None: | ||
return df | ||
else: | ||
df_filter = filter_def(df=df, logic=logic) | ||
return df_filter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import numpy | ||
import pandas | ||
from grplot.utils.check_data_structure import check_data_structure | ||
|
||
|
||
def filter_def(df, logic): | ||
# data structure | ||
data_structure = check_data_structure(df) | ||
if data_structure == 'pandas dataframe': | ||
if type(logic) == str: | ||
try: | ||
df_filter = df.query(logic) | ||
except: | ||
raise Exception('Wrong pandas query argument!') | ||
elif (type(logic) == pandas.core.series.Series) and (logic.dtype == bool): | ||
try: | ||
df_filter = df[logic] | ||
except: | ||
raise Exception('Wrong pandas filter argument!') | ||
else: | ||
raise Exception('Unsupported filter argument for pandas data type!') | ||
else: | ||
raise Exception('Unsupported data structure for filter argument!') | ||
return df_filter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import numpy | ||
import pandas | ||
|
||
def check_data_structure(df): | ||
if type(df) == dict: | ||
if any(isinstance(df[key], list) for key in df.keys()) == True: | ||
out = 'dictionary-list' | ||
elif any(isinstance(df[i], numpy.ndarray) for i in df.keys()): | ||
out = 'dictionary-numpy.array' | ||
else: | ||
raise Exception('Unsupported dictionary sub data structure!') | ||
elif type(df) == pandas.core.frame.DataFrame: | ||
out = 'pandas dataframe' | ||
else: | ||
raise Exception('Unsupported data structure!') | ||
return out | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
from setuptools import setup | ||
|
||
DISTNAME = "grplot" | ||
VERSION = "0.12.1" | ||
VERSION = "0.13.1" | ||
MAINTAINER = "Ghiffary Rifqialdi" | ||
MAINTAINER_EMAIL = "[email protected]" | ||
DESCRIPTION = "grplot: lazy statistical data visualization" | ||
|
@@ -40,6 +40,7 @@ | |
"grplot.features.add.text_add", | ||
"grplot.features.add.tick_add", | ||
"grplot.features.dt", | ||
"grplot.features.filter", | ||
"grplot.features.font", | ||
"grplot.features.legend", | ||
"grplot.features.lim", | ||
|