|
14 | 14 | # limitations under the License.
|
15 | 15 | #################################################################################################
|
16 | 16 | import os
|
17 |
| - |
18 | 17 | import pandas as pd
|
19 |
| - |
20 | 18 | ########################################
|
21 | 19 | import warnings
|
22 |
| - |
23 | 20 | from sklearn.exceptions import DataConversionWarning
|
24 |
| - |
25 | 21 | ####################################################################################
|
26 | 22 | import matplotlib
|
27 |
| - |
28 | 23 | import seaborn as sns
|
29 |
| - |
30 | 24 | import copy
|
31 | 25 | import time
|
32 | 26 | import traceback
|
33 | 27 | from pandas_dq import Fix_DQ, dq_report
|
34 |
| - |
35 | 28 | ##########################################################################################
|
36 | 29 | from autoviz.AutoViz_Holo import AutoViz_Holo
|
37 | 30 | from autoviz.AutoViz_Utils import draw_pivot_tables, draw_scatters
|
|
41 | 34 | from autoviz.AutoViz_Utils import find_remove_duplicates, classify_print_vars
|
42 | 35 | from autoviz.AutoViz_Utils import left_subtract
|
43 | 36 | from autoviz.AutoViz_NLP import draw_word_clouds
|
44 |
| - |
45 |
| - |
| 37 | +####################################################################################### |
46 | 38 | sns.set(style="ticks", color_codes=True)
|
47 |
| - |
48 | 39 | matplotlib.use('agg')
|
49 |
| - |
50 |
| - |
51 | 40 | warnings.filterwarnings(action='ignore', category=DataConversionWarning)
|
52 |
| - |
53 |
| - |
54 | 41 | warnings.filterwarnings("ignore")
|
55 |
| - |
56 |
| - |
| 42 | +####################################################################################### |
57 | 43 | def warn(*args, **kwargs):
|
58 | 44 | pass
|
59 |
| - |
60 |
| - |
61 | 45 | warnings.warn = warn
|
62 |
| - |
63 |
| - |
| 46 | +####################################################################################### |
64 | 47 | class AutoViz_Class:
|
65 | 48 | """
|
66 | 49 | ##############################################################################
|
@@ -205,7 +188,7 @@ def add_subheading(self, plotname, X):
|
205 | 188 | else:
|
206 | 189 | getattr(self, plotname)["subheading"].append(X)
|
207 | 190 |
|
208 |
| - def AutoViz(self, filename: (str or pd.DataFrame), sep=',', dep_var='', dfte=None, header=0, verbose=1, |
| 191 | + def AutoViz(self, filename: (str or pd.DataFrame), sep=',', depVar='', dfte=None, header=0, verbose=1, |
209 | 192 | lowess=False, chart_format='svg', max_rows_analyzed=150000,
|
210 | 193 | max_cols_analyzed=30, save_plot_dir=None):
|
211 | 194 | """
|
@@ -239,14 +222,15 @@ def AutoViz(self, filename: (str or pd.DataFrame), sep=',', dep_var='', dfte=Non
|
239 | 222 | #### it will simply save them. #####
|
240 | 223 | ##############################################################################
|
241 | 224 | """
|
242 |
| - if dfte: # temporary until we have a major release, then remove dfte variable. |
243 |
| - filename = dfte |
| 225 | + if isinstance(dfte, pd.DataFrame): ### if there is a dataframe, choose it |
| 226 | + filename = dfte |
244 | 227 |
|
245 |
| - if isinstance(dep_var, list): |
246 |
| - print('Since AutoViz cannot visualize multi-label targets, choosing first item in targets: %s' % dep_var[0]) |
247 |
| - dep_var = dep_var[0] |
248 |
| - |
249 |
| - #################################################################################### |
| 228 | + if isinstance(depVar, list): |
| 229 | + print('Since AutoViz cannot visualize multi-label targets, choosing first item in targets: %s' % depVar[0]) |
| 230 | + dep_var = depVar[0] |
| 231 | + else: |
| 232 | + dep_var = copy.deepcopy(depVar) |
| 233 | + #################################################################################### |
250 | 234 | if chart_format.lower() in ['bokeh', 'server', 'bokeh_server', 'bokeh-server', 'html']:
|
251 | 235 | dft = AutoViz_Holo(filename, sep, dep_var, header, verbose,
|
252 | 236 | lowess, chart_format, max_rows_analyzed,
|
|
0 commit comments