Hi all,
i'm getting an error while running the py tool, although this works in PyCharm.
"TypeError: No registered converter was able to extract a C++ pointer to type char from this Python object of type Container"
The result is a dataframe, although it throws that error. The goal of the script outputs the data from the excel tabs with few other columns (records that are highlighted in a color (which represent totals) and from which tab). For this i'm using StyleFrame.
Attached you can find the file, the workflow and the log.
You just need to update the file path in the .yxmd.
Thank you,
Regards,
Solved! Go to Solution.
Hi @jcardoso
Could you try installing the dlib package using the Python tool in Alteryx?
Thanks!
HI @TessaS , Thank you for your reply!
I did
Alteryx.installPackage("CMake")
Alteryx.installPackage("dlib")
as it was asking for the installation of CMake, so i did, and it installed the dlib package as print attached, although in the end it through the result attached, and didn't let the output to be performed
so, the error appeared again,
Thank you so much.
Hi @jcardoso
Thank you for trying that. Would you be able to email support@alteryx.com so we could investigate the issue thoroughly?
Thanks!
Hi @jcardoso,
Let me share the reply of our Python experts.
The issue lies with the data frame created from the StyleFrame library.
sf = StyleFrame.read_excel(excel_file_path, sheet_name=sheet_name, read_style=True, use_openpyxl_styles=False, skiprows=3)
Under the hood, the columns names are actually a 'Styleframe container', which the ayx package doesn't support:
sf.data_df.columns[0] <styleframe.container.Container at 0x22c8e75eb70>
The workaround is to rename the columns in sf to normal strings (my spacing may be off. Feel free to give cols different names)
new_col = [] for i, col in enumerate((sf.data_df.columns)): new_col.append(str(i)) sf.data_df.columns=new_col # get the hex code for each record sf_color = sf.applymap(convert_to_color_hex)
Fixing the columns, the workflow runs:
Fixed Jupyter Cell:
Thanks!
Hi @MichaelAd,
thank you for coming back to this! Yes, it does indeed sort it!
Although had to change the df as below after the column name change.
'value': sf[sf.data_df.columns[1]].values
Thank you so much for this,
Regards,