UnboundLocalError: local variable 'hv_all' referenced before assignment
priamai opened this issue · 6 comments
priamai commented
Hi there,
I am doing the simple test:
import pandas as pd
from autoviz import AutoViz_Class
AV = AutoViz_Class()
custom_plot_dir = "marketing"
data = {'col1': [1, 2, 3, 4, 5], 'col2': [5, 4, 3, 2, 1]}
df = pd.DataFrame(data)
dft = AV.AutoViz(
"",
sep=",",
depVar="",
dfte=df,
header=0,
verbose=1,
lowess=False,
chart_format="html",
max_rows_analyzed=150000,
max_cols_analyzed=30,
save_plot_dir=custom_plot_dir
)
Error trace
File /opt/conda/lib/python3.10/site-packages/autoviz/AutoViz_Class.py:257, in AutoViz_Class.AutoViz(self, filename, sep, depVar, dfte, header, verbose, lowess, chart_format, max_rows_analyzed, max_cols_analyzed, save_plot_dir)
255 ####################################################################################
256 if chart_format.lower() in ['bokeh','server','bokeh_server','bokeh-server', 'html']:
--> 257 dft = AutoViz_Holo(filename, sep, depVar, dfte, header, verbose,
258 lowess,chart_format,max_rows_analyzed,
259 max_cols_analyzed, save_plot_dir)
260 else:
261 dft = self.AutoViz_Main(filename, sep, depVar, dfte, header, verbose,
262 lowess,chart_format,max_rows_analyzed,
263 max_cols_analyzed, save_plot_dir)
File /opt/conda/lib/python3.10/site-packages/autoviz/AutoViz_Holo.py:181, in AutoViz_Holo(filename, sep, depVar, dfte, header, verbose, lowess, chart_format, max_rows_analyzed, max_cols_analyzed, save_plot_dir)
178 drawobj2 = draw_pair_scatters_hv(dfin, nums, problem_type, chart_format, dep,
179 classes, lowess, mk_dir, verbose)
180 ls_objects.append(drawobj2)
--> 181 drawobj3 = draw_distplot_hv(dfin, cats, nums, chart_format, problem_type, dep, classes, mk_dir, verbose)
182 ls_objects.append(drawobj3)
183 ### kdeplot is the only time you send in ls_objects since it has to be returned with 2 objects ###
File /opt/conda/lib/python3.10/site-packages/autoviz/AutoViz_Holo.py:681, in draw_distplot_hv(dft, cats, conti, chart_format, problem_type, dep, classes, mk_dir, verbose)
679 hv_all.show()
680 elif chart_format == 'html':
--> 681 save_html_data(hv_all, chart_format, plot_name, mk_dir, additional="_nums")
682 else:
683 display(hv_all) ### This will display it in a Jupyter Notebook. If you want it on a server, you use drawobj.show()
UnboundLocalError: local variable 'hv_all' referenced before assignment
Seems like hv_all was not declared?
priamai commented
AutoViML commented
This happens when the hv_all object is not created at all. If you have a snippet of data set (100 rows) and if you can post it here as a zip file attachment, I can find out what the problem is.
Can you also post what the code snippet is when you call AutoViz?Thanks for trying out AutoViz,Auto Vimal
On Sunday, September 3, 2023 at 06:52:45 PM EDT, priamai ***@***.***> wrote:
Forgot to mention my versions
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
priamai commented
Hello you don't need my dataset, as I have shown in the previous post, this fails in the standard example that you provided.
Just to highlight the data line is below:
data = {'col1': [1, 2, 3, 4, 5], 'col2': [5, 4, 3, 2, 1]}
df = pd.DataFrame(data)
AutoViML commented
Hey I might need to close this issue since you have not responded to my question with a real world example dataset. Let me know if you have one.Auto Vimal On Tuesday, September 5, 2023 at 09:12:59 AM EDT, priamai ***@***.***> wrote:
Hello you don't need my dataset, as I have shown in the previous post, this fails in the standard example that you provided.
Just to highlight the data line is below:
data = {'col1': [1, 2, 3, 4, 5], 'col2': [5, 4, 3, 2, 1]}
df = pd.DataFrame(data)
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you commented.Message ID: ***@***.***>
priamai commented
Hello I see now what you meant, because that is small but this worked
import pandas as pd
from autoviz import AutoViz_Class
AV = AutoViz_Class()
custom_plot_dir = "autocar"
df = pd.read_csv("https://raw.githubusercontent.com/plotly/datasets/master/auto-mpg.csv")
dft = AV.AutoViz(
"",
depVar="",
dfte=df,
header=0,
verbose=1,
lowess=False,
chart_format="html",
max_rows_analyzed=150000,
max_cols_analyzed=30,
save_plot_dir=custom_plot_dir
)
Closing now!
jijivski commented
Same problem solved, I think it's better to set this as the sample, or mark out that the standard DataFrame is not meant to be run, just a format. :D