Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'NoneType' object has no attribute 'replace' #1549

Open
Crispinli opened this issue Feb 20, 2024 · 4 comments
Open

'NoneType' object has no attribute 'replace' #1549

Crispinli opened this issue Feb 20, 2024 · 4 comments
Labels
information requested ❔ Cannot reproduce, waiting for minimum reproduction details.

Comments

@Crispinli
Copy link

Crispinli commented Feb 20, 2024

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!

@fabclmnt
Copy link
Contributor

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?

@fabclmnt fabclmnt added information requested ❔ Cannot reproduce, waiting for minimum reproduction details. and removed needs-triage labels Feb 22, 2024
@stnvapm
Copy link

stnvapm commented Mar 1, 2024

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'

@vrbabu9000
Copy link

vrbabu9000 commented Apr 26, 2024

@stnvapm Were you able to find a solution for this error? It worked for me with python 3.10.6

@fabclmnt
Copy link
Contributor

fabclmnt commented May 6, 2024

Hi @stnvapm ,

can you please share the python packages that you have installed in your environment as well as their versions?

If you could share more details on your data as well that would be helpful to reproduce.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
information requested ❔ Cannot reproduce, waiting for minimum reproduction details.
Projects
None yet
Development

No branches or pull requests

5 participants