We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
An Error is emitted when the ‘count’field is present in DataFrame
**Describe the bug**

1.When I load a local file with a count field, it looks like this:

![image](https://user-images.githubusercontent.com/39480659/110434491-d8086c80-80ec-11eb-9b4a-57963df424b6.png)

2. So I'm going to go ahead and execute, I met this error:
'cannot insert count, already exists'

its all:
`---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
~/anaconda3/lib/python3.7/site-packages/IPython/core/formatters.py in __call__(self, obj)
    343             method = get_real_method(obj, self.print_method)
    344             if method is not None:
--> 345                 return method()
    346             return None
    347         else:

~/anaconda3/lib/python3.7/site-packages/pandas_profiling/profile_report.py in _repr_html_(self)
    434     def _repr_html_(self):
    435         """The ipython notebook widgets user interface gets called by the jupyter notebook."""
--> 436         self.to_notebook_iframe()
    437 
    438     def __repr__(self):

~/anaconda3/lib/python3.7/site-packages/pandas_profiling/profile_report.py in to_notebook_iframe(self)
    414         with warnings.catch_warnings():
    415             warnings.simplefilter("ignore")
--> 416             display(get_notebook_iframe(self))
    417 
    418     def to_widgets(self):

~/anaconda3/lib/python3.7/site-packages/pandas_profiling/report/presentation/flavours/widget/notebook.py in get_notebook_iframe(profile)
     63         output = get_notebook_iframe_src(profile)
     64     elif attribute == "srcdoc":
---> 65         output = get_notebook_iframe_srcdoc(profile)
     66     else:
     67         raise ValueError(

~/anaconda3/lib/python3.7/site-packages/pandas_profiling/report/presentation/flavours/widget/notebook.py in get_notebook_iframe_srcdoc(profile)
     21     width = config["notebook"]["iframe"]["width"].get(str)
     22     height = config["notebook"]["iframe"]["height"].get(str)
---> 23     src = html.escape(profile.to_html())
     24 
     25     iframe = f'<iframe width="{width}" height="{height}" srcdoc="{src}" frameborder="0" allowfullscreen></iframe>'

~/anaconda3/lib/python3.7/site-packages/pandas_profiling/profile_report.py in to_html(self)
    384 
    385         """
--> 386         return self.html
    387 
    388     def to_json(self) -> str:

~/anaconda3/lib/python3.7/site-packages/pandas_profiling/profile_report.py in html(self)
    199     def html(self):
    200         if self._html is None:
--> 201             self._html = self._render_html()
    202         return self._html
    203 

~/anaconda3/lib/python3.7/site-packages/pandas_profiling/profile_report.py in _render_html(self)
    306         from pandas_profiling.report.presentation.flavours import HTMLReport
    307 
--> 308         report = self.report
    309 
    310         disable_progress_bar = not config["progress_bar"].get(bool)

~/anaconda3/lib/python3.7/site-packages/pandas_profiling/profile_report.py in report(self)
    193     def report(self):
    194         if self._report is None:
--> 195             self._report = get_report_structure(self.description_set)
    196         return self._report
    197 

~/anaconda3/lib/python3.7/site-packages/pandas_profiling/profile_report.py in description_set(self)
    173         if self._description_set is None:
    174             self._description_set = describe_df(
--> 175                 self.title, self.df, self.summarizer, self.typeset, self._sample
    176             )
    177         return self._description_set

~/anaconda3/lib/python3.7/site-packages/pandas_profiling/model/describe.py in describe(title, df, summarizer, typeset, sample)
    135         # Duplicates
    136         pbar.set_postfix_str("Locating duplicates")
--> 137         duplicates = get_duplicates(df, supported_columns)
    138         pbar.update()
    139 

~/anaconda3/lib/python3.7/site-packages/pandas_profiling/model/duplicates.py in get_duplicates(df, supported_columns)
     23             .groupby(supported_columns)
     24             .size()
---> 25             .reset_index(name="count")
     26             .nlargest(n_head, "count")
     27         )

~/anaconda3/lib/python3.7/site-packages/pandas/core/series.py in reset_index(self, level, drop, name, inplace)
   1247         else:
   1248             df = self.to_frame(name)
-> 1249             return df.reset_index(level=level, drop=drop)
   1250 
   1251     # ----------------------------------------------------------------------

~/anaconda3/lib/python3.7/site-packages/pandas/core/frame.py in reset_index(self, level, drop, inplace, col_level, col_fill)
   5011                 # to ndarray and maybe infer different dtype
   5012                 level_values = maybe_casted_values(lev, lab)
-> 5013                 new_obj.insert(0, name, level_values)
   5014 
   5015         new_obj.index = new_index

~/anaconda3/lib/python3.7/site-packages/pandas/core/frame.py in insert(self, loc, column, value, allow_duplicates)
   3758         self._ensure_valid_index(value)
   3759         value = self._sanitize_column(column, value, broadcast=False)
-> 3760         self._mgr.insert(loc, column, value, allow_duplicates=allow_duplicates)
   3761 
   3762     def assign(self, **kwargs) -> DataFrame:

~/anaconda3/lib/python3.7/site-packages/pandas/core/internals/managers.py in insert(self, loc, item, value, allow_duplicates)
   1189         if not allow_duplicates and item in self.items:
   1190             # Should this be a different kind of error??
-> 1191             raise ValueError(f"cannot insert {item}, already exists")
   1192 
   1193         if not isinstance(loc, int):

ValueError: cannot insert count, already exists`


3. I removed the 'count' field in train_df as if there was a conflict between my original field and the subsequent naming
4. It seems to have worked

![image](https://user-images.githubusercontent.com/39480659/110435223-b491f180-80ed-11eb-8d48-735b05f85359.png)





An Error is emitted when the ‘count’field is present in DataFrame
**Describe the bug**

1.When I load a local file with a count field, it looks like this:

![image](https://user-images.githubusercontent.com/39480659/110434491-d8086c80-80ec-11eb-9b4a-57963df424b6.png)

2. So I'm going to go ahead and execute, I met this error:
'cannot insert count, already exists'

its all:
`---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
~/anaconda3/lib/python3.7/site-packages/IPython/core/formatters.py in __call__(self, obj)
    343             method = get_real_method(obj, self.print_method)
    344             if method is not None:
--> 345                 return method()
    346             return None
    347         else:

~/anaconda3/lib/python3.7/site-packages/pandas_profiling/profile_report.py in _repr_html_(self)
    434     def _repr_html_(self):
    435         """The ipython notebook widgets user interface gets called by the jupyter notebook."""
--> 436         self.to_notebook_iframe()
    437 
    438     def __repr__(self):

~/anaconda3/lib/python3.7/site-packages/pandas_profiling/profile_report.py in to_notebook_iframe(self)
    414         with warnings.catch_warnings():
    415             warnings.simplefilter("ignore")
--> 416             display(get_notebook_iframe(self))
    417 
    418     def to_widgets(self):

~/anaconda3/lib/python3.7/site-packages/pandas_profiling/report/presentation/flavours/widget/notebook.py in get_notebook_iframe(profile)
     63         output = get_notebook_iframe_src(profile)
     64     elif attribute == "srcdoc":
---> 65         output = get_notebook_iframe_srcdoc(profile)
     66     else:
     67         raise ValueError(

~/anaconda3/lib/python3.7/site-packages/pandas_profiling/report/presentation/flavours/widget/notebook.py in get_notebook_iframe_srcdoc(profile)
     21     width = config["notebook"]["iframe"]["width"].get(str)
     22     height = config["notebook"]["iframe"]["height"].get(str)
---> 23     src = html.escape(profile.to_html())
     24 
     25     iframe = f'<iframe width="{width}" height="{height}" srcdoc="{src}" frameborder="0" allowfullscreen></iframe>'

~/anaconda3/lib/python3.7/site-packages/pandas_profiling/profile_report.py in to_html(self)
    384 
    385         """
--> 386         return self.html
    387 
    388     def to_json(self) -> str:

~/anaconda3/lib/python3.7/site-packages/pandas_profiling/profile_report.py in html(self)
    199     def html(self):
    200         if self._html is None:
--> 201             self._html = self._render_html()
    202         return self._html
    203 

~/anaconda3/lib/python3.7/site-packages/pandas_profiling/profile_report.py in _render_html(self)
    306         from pandas_profiling.report.presentation.flavours import HTMLReport
    307 
--> 308         report = self.report
    309 
    310         disable_progress_bar = not config["progress_bar"].get(bool)

~/anaconda3/lib/python3.7/site-packages/pandas_profiling/profile_report.py in report(self)
    193     def report(self):
    194         if self._report is None:
--> 195             self._report = get_report_structure(self.description_set)
    196         return self._report
    197 

~/anaconda3/lib/python3.7/site-packages/pandas_profiling/profile_report.py in description_set(self)
    173         if self._description_set is None:
    174             self._description_set = describe_df(
--> 175                 self.title, self.df, self.summarizer, self.typeset, self._sample
    176             )
    177         return self._description_set

~/anaconda3/lib/python3.7/site-packages/pandas_profiling/model/describe.py in describe(title, df, summarizer, typeset, sample)
    135         # Duplicates
    136         pbar.set_postfix_str("Locating duplicates")
--> 137         duplicates = get_duplicates(df, supported_columns)
    138         pbar.update()
    139 

~/anaconda3/lib/python3.7/site-packages/pandas_profiling/model/duplicates.py in get_duplicates(df, supported_columns)
     23             .groupby(supported_columns)
     24             .size()
---> 25             .reset_index(name="count")
     26             .nlargest(n_head, "count")
     27         )

~/anaconda3/lib/python3.7/site-packages/pandas/core/series.py in reset_index(self, level, drop, name, inplace)
   1247         else:
   1248             df = self.to_frame(name)
-> 1249             return df.reset_index(level=level, drop=drop)
   1250 
   1251     # ----------------------------------------------------------------------

~/anaconda3/lib/python3.7/site-packages/pandas/core/frame.py in reset_index(self, level, drop, inplace, col_level, col_fill)
   5011                 # to ndarray and maybe infer different dtype
   5012                 level_values = maybe_casted_values(lev, lab)
-> 5013                 new_obj.insert(0, name, level_values)
   5014 
   5015         new_obj.index = new_index

~/anaconda3/lib/python3.7/site-packages/pandas/core/frame.py in insert(self, loc, column, value, allow_duplicates)
   3758         self._ensure_valid_index(value)
   3759         value = self._sanitize_column(column, value, broadcast=False)
-> 3760         self._mgr.insert(loc, column, value, allow_duplicates=allow_duplicates)
   3761 
   3762     def assign(self, **kwargs) -> DataFrame:

~/anaconda3/lib/python3.7/site-packages/pandas/core/internals/managers.py in insert(self, loc, item, value, allow_duplicates)
   1189         if not allow_duplicates and item in self.items:
   1190             # Should this be a different kind of error??
-> 1191             raise ValueError(f"cannot insert {item}, already exists")
   1192 
   1193         if not isinstance(loc, int):

ValueError: cannot insert count, already exists`


3. I removed the 'count' field in train_df as if there was a conflict between my original field and the subsequent naming
4. It seems to have worked

![image](https://user-images.githubusercontent.com/39480659/110435223-b491f180-80ed-11eb-8d48-735b05f85359.png)






--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `src/pandas_profiling/model/duplicates.py`
Content:
```
1 from typing import Optional
2 
3 import pandas as pd
4 
5 from pandas_profiling.config import config
6 
7 
8 def get_duplicates(df: pd.DataFrame, supported_columns) -> Optional[pd.DataFrame]:
9     """Obtain the most occurring duplicate rows in the DataFrame.
10 
11     Args:
12         df: the Pandas DataFrame.
13         supported_columns: the columns to consider
14 
15     Returns:
16         A subset of the DataFrame, ordered by occurrence.
17     """
18     n_head = config["duplicates"]["head"].get(int)
19 
20     if n_head > 0 and supported_columns:
21         return (
22             df[df.duplicated(subset=supported_columns, keep=False)]
23             .groupby(supported_columns)
24             .size()
25             .reset_index(name="count")
26             .nlargest(n_head, "count")
27         )
28     return None
29
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/src/pandas_profiling/model/duplicates.py b/src/pandas_profiling/model/duplicates.py
--- a/src/pandas_profiling/model/duplicates.py
+++ b/src/pandas_profiling/model/duplicates.py
@@ -18,11 +18,18 @@
     n_head = config["duplicates"]["head"].get(int)
 
     if n_head > 0 and supported_columns:
+        duplicates_key = config["duplicates"]["key"].get(str)
+        if duplicates_key in df.columns:
+            raise ValueError(
+                f"Duplicates key ({duplicates_key}) may not be part of the DataFrame. Either change the "
+                f" column name in the DataFrame or change the 'duplicates.key' parameter."
+            )
+
         return (
             df[df.duplicated(subset=supported_columns, keep=False)]
             .groupby(supported_columns)
             .size()
-            .reset_index(name="count")
-            .nlargest(n_head, "count")
+            .reset_index(name=duplicates_key)
+            .nlargest(n_head, duplicates_key)
         )
     return None

{"golden_diff": "diff --git a/src/pandas_profiling/model/duplicates.py b/src/pandas_profiling/model/duplicates.py\n--- a/src/pandas_profiling/model/duplicates.py\n+++ b/src/pandas_profiling/model/duplicates.py\n@@ -18,11 +18,18 @@\n     n_head = config[\"duplicates\"][\"head\"].get(int)\r\n \r\n     if n_head > 0 and supported_columns:\r\n+        duplicates_key = config[\"duplicates\"][\"key\"].get(str)\r\n+        if duplicates_key in df.columns:\r\n+            raise ValueError(\r\n+                f\"Duplicates key ({duplicates_key}) may not be part of the DataFrame. Either change the \"\r\n+                f\" column name in the DataFrame or change the 'duplicates.key' parameter.\"\r\n+            )\r\n+\r\n         return (\r\n             df[df.duplicated(subset=supported_columns, keep=False)]\r\n             .groupby(supported_columns)\r\n             .size()\r\n-            .reset_index(name=\"count\")\r\n-            .nlargest(n_head, \"count\")\r\n+            .reset_index(name=duplicates_key)\r\n+            .nlargest(n_head, duplicates_key)\r\n         )\r\n     return None\n", "issue": "An Error is emitted when the \u2018count\u2019field is present in DataFrame\n**Describe the bug**\r\n\r\n1.When I load a local file with a count field, it looks like this:\r\n\r\n![image](https://user-images.githubusercontent.com/39480659/110434491-d8086c80-80ec-11eb-9b4a-57963df424b6.png)\r\n\r\n2. So I'm going to go ahead and execute, I met this error:\r\n'cannot insert count, already exists'\r\n\r\nits all:\r\n`---------------------------------------------------------------------------\r\nValueError                                Traceback (most recent call last)\r\n~/anaconda3/lib/python3.7/site-packages/IPython/core/formatters.py in __call__(self, obj)\r\n    343             method = get_real_method(obj, self.print_method)\r\n    344             if method is not None:\r\n--> 345                 return method()\r\n    346             return None\r\n    347         else:\r\n\r\n~/anaconda3/lib/python3.7/site-packages/pandas_profiling/profile_report.py in _repr_html_(self)\r\n    434     def _repr_html_(self):\r\n    435         \"\"\"The ipython notebook widgets user interface gets called by the jupyter notebook.\"\"\"\r\n--> 436         self.to_notebook_iframe()\r\n    437 \r\n    438     def __repr__(self):\r\n\r\n~/anaconda3/lib/python3.7/site-packages/pandas_profiling/profile_report.py in to_notebook_iframe(self)\r\n    414         with warnings.catch_warnings():\r\n    415             warnings.simplefilter(\"ignore\")\r\n--> 416             display(get_notebook_iframe(self))\r\n    417 \r\n    418     def to_widgets(self):\r\n\r\n~/anaconda3/lib/python3.7/site-packages/pandas_profiling/report/presentation/flavours/widget/notebook.py in get_notebook_iframe(profile)\r\n     63         output = get_notebook_iframe_src(profile)\r\n     64     elif attribute == \"srcdoc\":\r\n---> 65         output = get_notebook_iframe_srcdoc(profile)\r\n     66     else:\r\n     67         raise ValueError(\r\n\r\n~/anaconda3/lib/python3.7/site-packages/pandas_profiling/report/presentation/flavours/widget/notebook.py in get_notebook_iframe_srcdoc(profile)\r\n     21     width = config[\"notebook\"][\"iframe\"][\"width\"].get(str)\r\n     22     height = config[\"notebook\"][\"iframe\"][\"height\"].get(str)\r\n---> 23     src = html.escape(profile.to_html())\r\n     24 \r\n     25     iframe = f'<iframe width=\"{width}\" height=\"{height}\" srcdoc=\"{src}\" frameborder=\"0\" allowfullscreen></iframe>'\r\n\r\n~/anaconda3/lib/python3.7/site-packages/pandas_profiling/profile_report.py in to_html(self)\r\n    384 \r\n    385         \"\"\"\r\n--> 386         return self.html\r\n    387 \r\n    388     def to_json(self) -> str:\r\n\r\n~/anaconda3/lib/python3.7/site-packages/pandas_profiling/profile_report.py in html(self)\r\n    199     def html(self):\r\n    200         if self._html is None:\r\n--> 201             self._html = self._render_html()\r\n    202         return self._html\r\n    203 \r\n\r\n~/anaconda3/lib/python3.7/site-packages/pandas_profiling/profile_report.py in _render_html(self)\r\n    306         from pandas_profiling.report.presentation.flavours import HTMLReport\r\n    307 \r\n--> 308         report = self.report\r\n    309 \r\n    310         disable_progress_bar = not config[\"progress_bar\"].get(bool)\r\n\r\n~/anaconda3/lib/python3.7/site-packages/pandas_profiling/profile_report.py in report(self)\r\n    193     def report(self):\r\n    194         if self._report is None:\r\n--> 195             self._report = get_report_structure(self.description_set)\r\n    196         return self._report\r\n    197 \r\n\r\n~/anaconda3/lib/python3.7/site-packages/pandas_profiling/profile_report.py in description_set(self)\r\n    173         if self._description_set is None:\r\n    174             self._description_set = describe_df(\r\n--> 175                 self.title, self.df, self.summarizer, self.typeset, self._sample\r\n    176             )\r\n    177         return self._description_set\r\n\r\n~/anaconda3/lib/python3.7/site-packages/pandas_profiling/model/describe.py in describe(title, df, summarizer, typeset, sample)\r\n    135         # Duplicates\r\n    136         pbar.set_postfix_str(\"Locating duplicates\")\r\n--> 137         duplicates = get_duplicates(df, supported_columns)\r\n    138         pbar.update()\r\n    139 \r\n\r\n~/anaconda3/lib/python3.7/site-packages/pandas_profiling/model/duplicates.py in get_duplicates(df, supported_columns)\r\n     23             .groupby(supported_columns)\r\n     24             .size()\r\n---> 25             .reset_index(name=\"count\")\r\n     26             .nlargest(n_head, \"count\")\r\n     27         )\r\n\r\n~/anaconda3/lib/python3.7/site-packages/pandas/core/series.py in reset_index(self, level, drop, name, inplace)\r\n   1247         else:\r\n   1248             df = self.to_frame(name)\r\n-> 1249             return df.reset_index(level=level, drop=drop)\r\n   1250 \r\n   1251     # ----------------------------------------------------------------------\r\n\r\n~/anaconda3/lib/python3.7/site-packages/pandas/core/frame.py in reset_index(self, level, drop, inplace, col_level, col_fill)\r\n   5011                 # to ndarray and maybe infer different dtype\r\n   5012                 level_values = maybe_casted_values(lev, lab)\r\n-> 5013                 new_obj.insert(0, name, level_values)\r\n   5014 \r\n   5015         new_obj.index = new_index\r\n\r\n~/anaconda3/lib/python3.7/site-packages/pandas/core/frame.py in insert(self, loc, column, value, allow_duplicates)\r\n   3758         self._ensure_valid_index(value)\r\n   3759         value = self._sanitize_column(column, value, broadcast=False)\r\n-> 3760         self._mgr.insert(loc, column, value, allow_duplicates=allow_duplicates)\r\n   3761 \r\n   3762     def assign(self, **kwargs) -> DataFrame:\r\n\r\n~/anaconda3/lib/python3.7/site-packages/pandas/core/internals/managers.py in insert(self, loc, item, value, allow_duplicates)\r\n   1189         if not allow_duplicates and item in self.items:\r\n   1190             # Should this be a different kind of error??\r\n-> 1191             raise ValueError(f\"cannot insert {item}, already exists\")\r\n   1192 \r\n   1193         if not isinstance(loc, int):\r\n\r\nValueError: cannot insert count, already exists`\r\n\r\n\r\n3. I removed the 'count' field in train_df as if there was a conflict between my original field and the subsequent naming\r\n4. It seems to have worked\r\n\r\n![image](https://user-images.githubusercontent.com/39480659/110435223-b491f180-80ed-11eb-8d48-735b05f85359.png)\r\n\r\n\r\n\r\n\r\n\nAn Error is emitted when the \u2018count\u2019field is present in DataFrame\n**Describe the bug**\r\n\r\n1.When I load a local file with a count field, it looks like this:\r\n\r\n![image](https://user-images.githubusercontent.com/39480659/110434491-d8086c80-80ec-11eb-9b4a-57963df424b6.png)\r\n\r\n2. So I'm going to go ahead and execute, I met this error:\r\n'cannot insert count, already exists'\r\n\r\nits all:\r\n`---------------------------------------------------------------------------\r\nValueError                                Traceback (most recent call last)\r\n~/anaconda3/lib/python3.7/site-packages/IPython/core/formatters.py in __call__(self, obj)\r\n    343             method = get_real_method(obj, self.print_method)\r\n    344             if method is not None:\r\n--> 345                 return method()\r\n    346             return None\r\n    347         else:\r\n\r\n~/anaconda3/lib/python3.7/site-packages/pandas_profiling/profile_report.py in _repr_html_(self)\r\n    434     def _repr_html_(self):\r\n    435         \"\"\"The ipython notebook widgets user interface gets called by the jupyter notebook.\"\"\"\r\n--> 436         self.to_notebook_iframe()\r\n    437 \r\n    438     def __repr__(self):\r\n\r\n~/anaconda3/lib/python3.7/site-packages/pandas_profiling/profile_report.py in to_notebook_iframe(self)\r\n    414         with warnings.catch_warnings():\r\n    415             warnings.simplefilter(\"ignore\")\r\n--> 416             display(get_notebook_iframe(self))\r\n    417 \r\n    418     def to_widgets(self):\r\n\r\n~/anaconda3/lib/python3.7/site-packages/pandas_profiling/report/presentation/flavours/widget/notebook.py in get_notebook_iframe(profile)\r\n     63         output = get_notebook_iframe_src(profile)\r\n     64     elif attribute == \"srcdoc\":\r\n---> 65         output = get_notebook_iframe_srcdoc(profile)\r\n     66     else:\r\n     67         raise ValueError(\r\n\r\n~/anaconda3/lib/python3.7/site-packages/pandas_profiling/report/presentation/flavours/widget/notebook.py in get_notebook_iframe_srcdoc(profile)\r\n     21     width = config[\"notebook\"][\"iframe\"][\"width\"].get(str)\r\n     22     height = config[\"notebook\"][\"iframe\"][\"height\"].get(str)\r\n---> 23     src = html.escape(profile.to_html())\r\n     24 \r\n     25     iframe = f'<iframe width=\"{width}\" height=\"{height}\" srcdoc=\"{src}\" frameborder=\"0\" allowfullscreen></iframe>'\r\n\r\n~/anaconda3/lib/python3.7/site-packages/pandas_profiling/profile_report.py in to_html(self)\r\n    384 \r\n    385         \"\"\"\r\n--> 386         return self.html\r\n    387 \r\n    388     def to_json(self) -> str:\r\n\r\n~/anaconda3/lib/python3.7/site-packages/pandas_profiling/profile_report.py in html(self)\r\n    199     def html(self):\r\n    200         if self._html is None:\r\n--> 201             self._html = self._render_html()\r\n    202         return self._html\r\n    203 \r\n\r\n~/anaconda3/lib/python3.7/site-packages/pandas_profiling/profile_report.py in _render_html(self)\r\n    306         from pandas_profiling.report.presentation.flavours import HTMLReport\r\n    307 \r\n--> 308         report = self.report\r\n    309 \r\n    310         disable_progress_bar = not config[\"progress_bar\"].get(bool)\r\n\r\n~/anaconda3/lib/python3.7/site-packages/pandas_profiling/profile_report.py in report(self)\r\n    193     def report(self):\r\n    194         if self._report is None:\r\n--> 195             self._report = get_report_structure(self.description_set)\r\n    196         return self._report\r\n    197 \r\n\r\n~/anaconda3/lib/python3.7/site-packages/pandas_profiling/profile_report.py in description_set(self)\r\n    173         if self._description_set is None:\r\n    174             self._description_set = describe_df(\r\n--> 175                 self.title, self.df, self.summarizer, self.typeset, self._sample\r\n    176             )\r\n    177         return self._description_set\r\n\r\n~/anaconda3/lib/python3.7/site-packages/pandas_profiling/model/describe.py in describe(title, df, summarizer, typeset, sample)\r\n    135         # Duplicates\r\n    136         pbar.set_postfix_str(\"Locating duplicates\")\r\n--> 137         duplicates = get_duplicates(df, supported_columns)\r\n    138         pbar.update()\r\n    139 \r\n\r\n~/anaconda3/lib/python3.7/site-packages/pandas_profiling/model/duplicates.py in get_duplicates(df, supported_columns)\r\n     23             .groupby(supported_columns)\r\n     24             .size()\r\n---> 25             .reset_index(name=\"count\")\r\n     26             .nlargest(n_head, \"count\")\r\n     27         )\r\n\r\n~/anaconda3/lib/python3.7/site-packages/pandas/core/series.py in reset_index(self, level, drop, name, inplace)\r\n   1247         else:\r\n   1248             df = self.to_frame(name)\r\n-> 1249             return df.reset_index(level=level, drop=drop)\r\n   1250 \r\n   1251     # ----------------------------------------------------------------------\r\n\r\n~/anaconda3/lib/python3.7/site-packages/pandas/core/frame.py in reset_index(self, level, drop, inplace, col_level, col_fill)\r\n   5011                 # to ndarray and maybe infer different dtype\r\n   5012                 level_values = maybe_casted_values(lev, lab)\r\n-> 5013                 new_obj.insert(0, name, level_values)\r\n   5014 \r\n   5015         new_obj.index = new_index\r\n\r\n~/anaconda3/lib/python3.7/site-packages/pandas/core/frame.py in insert(self, loc, column, value, allow_duplicates)\r\n   3758         self._ensure_valid_index(value)\r\n   3759         value = self._sanitize_column(column, value, broadcast=False)\r\n-> 3760         self._mgr.insert(loc, column, value, allow_duplicates=allow_duplicates)\r\n   3761 \r\n   3762     def assign(self, **kwargs) -> DataFrame:\r\n\r\n~/anaconda3/lib/python3.7/site-packages/pandas/core/internals/managers.py in insert(self, loc, item, value, allow_duplicates)\r\n   1189         if not allow_duplicates and item in self.items:\r\n   1190             # Should this be a different kind of error??\r\n-> 1191             raise ValueError(f\"cannot insert {item}, already exists\")\r\n   1192 \r\n   1193         if not isinstance(loc, int):\r\n\r\nValueError: cannot insert count, already exists`\r\n\r\n\r\n3. I removed the 'count' field in train_df as if there was a conflict between my original field and the subsequent naming\r\n4. It seems to have worked\r\n\r\n![image](https://user-images.githubusercontent.com/39480659/110435223-b491f180-80ed-11eb-8d48-735b05f85359.png)\r\n\r\n\r\n\r\n\r\n\n", "before_files": [{"content": "from typing import Optional\r\n\r\nimport pandas as pd\r\n\r\nfrom pandas_profiling.config import config\r\n\r\n\r\ndef get_duplicates(df: pd.DataFrame, supported_columns) -> Optional[pd.DataFrame]:\r\n    \"\"\"Obtain the most occurring duplicate rows in the DataFrame.\r\n\r\n    Args:\r\n        df: the Pandas DataFrame.\r\n        supported_columns: the columns to consider\r\n\r\n    Returns:\r\n        A subset of the DataFrame, ordered by occurrence.\r\n    \"\"\"\r\n    n_head = config[\"duplicates\"][\"head\"].get(int)\r\n\r\n    if n_head > 0 and supported_columns:\r\n        return (\r\n            df[df.duplicated(subset=supported_columns, keep=False)]\r\n            .groupby(supported_columns)\r\n            .size()\r\n            .reset_index(name=\"count\")\r\n            .nlargest(n_head, \"count\")\r\n        )\r\n    return None\r\n", "path": "src/pandas_profiling/model/duplicates.py"}], "after_files": [{"content": "from typing import Optional\r\n\r\nimport pandas as pd\r\n\r\nfrom pandas_profiling.config import config\r\n\r\n\r\ndef get_duplicates(df: pd.DataFrame, supported_columns) -> Optional[pd.DataFrame]:\r\n    \"\"\"Obtain the most occurring duplicate rows in the DataFrame.\r\n\r\n    Args:\r\n        df: the Pandas DataFrame.\r\n        supported_columns: the columns to consider\r\n\r\n    Returns:\r\n        A subset of the DataFrame, ordered by occurrence.\r\n    \"\"\"\r\n    n_head = config[\"duplicates\"][\"head\"].get(int)\r\n\r\n    if n_head > 0 and supported_columns:\r\n        duplicates_key = config[\"duplicates\"][\"key\"].get(str)\r\n        if duplicates_key in df.columns:\r\n            raise ValueError(\r\n                f\"Duplicates key ({duplicates_key}) may not be part of the DataFrame. Either change the \"\r\n                f\" column name in the DataFrame or change the 'duplicates.key' parameter.\"\r\n            )\r\n\r\n        return (\r\n            df[df.duplicated(subset=supported_columns, keep=False)]\r\n            .groupby(supported_columns)\r\n            .size()\r\n            .reset_index(name=duplicates_key)\r\n            .nlargest(n_head, duplicates_key)\r\n        )\r\n    return None\r\n", "path": "src/pandas_profiling/model/duplicates.py"}]}