'NoneType' object has no attribute 'replace'
Crispinli opened this issue · comments
Crispinli commented
I got the error when I run my code on Linux Machine as follows:
Traceback (most recent call last):
File "/c_search_recall/eda_jd.py", line 40, in <module>
report.to_file('data/jd_eda_report.html')
File "/miniconda3/envs/recall/lib/python3.11/site-packages/ydata_profiling/profile_report.py", line 370, in to_file
data = self.to_html()
^^^^^^^^^^^^^^
File "/miniconda3/envs/recall/lib/python3.11/site-packages/ydata_profiling/profile_report.py", line 485, in to_html
return self.html
^^^^^^^^^
File "/miniconda3/envs/recall/lib/python3.11/site-packages/ydata_profiling/profile_report.py", line 283, in html
self._html = self._render_html()
^^^^^^^^^^^^^^^^^^^
File "/miniconda3/envs/recall/lib/python3.11/site-packages/ydata_profiling/profile_report.py", line 400, in _render_html
report = self.report
^^^^^^^^^^^
File "/miniconda3/envs/recall/lib/python3.11/site-packages/ydata_profiling/profile_report.py", line 277, in report
self._report = get_report_structure(self.config, self.description_set)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/miniconda3/envs/recall/lib/python3.11/site-packages/ydata_profiling/report/structure/report.py", line 387, in get_report_structure
render_variables_section(config, summary),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/miniconda3/envs/recall/lib/python3.11/site-packages/ydata_profiling/report/structure/report.py", line 162, in render_variables_section
template_variables.update(render_map_type(config, template_variables))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/miniconda3/envs/recall/lib/python3.11/site-packages/ydata_profiling/report/structure/variables/render_text.py", line 100, in render_text
overview_table_char, unitab = render_categorical_unicode(config, summary, varid)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/miniconda3/envs/recall/lib/python3.11/site-packages/ydata_profiling/report/structure/variables/render_categorical.py", line 139, in render_categorical_unicode
category_alias_name = category_alias_name.replace("_", " ")
^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'replace'
python version: 3.11
ydata-profiling version: 4.6.4
Please help me, thx!
Fabiana commented
HI @Crispinli ,
More detail is required as this seems to be related with the data that you are currently. Can you please provide the code that you are using as well as some information regarding the dataset?
Angie Michailidou commented
I have the same issue
ydata_profiling in /usr/local/lib/python3.10/dist-packages (4.6.5)
import pandas as pd
from ydata_profiling import ProfileReport
df = pd.read_csv("/content/drive/MyDrive/linkdin_Job_data.csv")
report = ProfileReport(df, title='My Data')
report.to_file("my_report.html")
Summarize dataset: 100%
27/27 [00:09<00:00, 1.72it/s, Completed]
Generate report structure: 0%
0/1 [00:17<?, ?it/s]
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
[<ipython-input-13-4430cb1792cb>](https://localhost:8080/#) in <cell line: 9>()
7 # Generate the data profiling report
8 report = ProfileReport(df, title='My Data')
----> 9 report.to_file("my_report.html")
8 frames
[/usr/local/lib/python3.10/dist-packages/ydata_profiling/report/structure/variables/render_categorical.py](https://localhost:8080/#) in render_categorical_unicode(config, summary, varid)
137 summary["category_alias_char_counts"].items(), key=lambda x: -len(x[1])
138 ):
--> 139 category_alias_name = category_alias_name.replace("_", " ")
140 cats.append(
141 FrequencyTable(
AttributeError: 'NoneType' object has no attribute 'replace'
Vignesh Rajesh Babu commented
@stnvapm Were you able to find a solution for this error? It worked for me with python 3.10.6