BUG: Assertion error : Gaps in blk ref_locs in pandas profiling
Hi Everyone,

I think i am facing a similar kind of issue.
I have created a django utility that is using pandas profiling.

The steps that i am doing is python are-
1-Uploading a file
df = pd.read_csv(path)

2- Changing the datatypes of columns from objects to category
df.select_dtypes(['object']).apply(pd.Series.astype, dtype='category')], axis=1).reindex(df.columns, axis=1)

3- Separating continuous and categorical variables from the dataframe and sending this information to multiselect dropdown in HTML

4- As per user selection from continuous and categorical variables dropdown, storing the selections in form of list.
context['selectedContinousValues'] = request.POST.getlist('continous')
context['selectedCategoricalValues'] = request.POST.getlist('categorical')

5- Combining both list and keeping the list items from df.
Profiling_variables=context['selectedContinousValues']+context['selectedCategoricalValues']
print(Profiling_variables)
profile=df[Profiling_variables]

6- Using this selected df in pandas profiling
profile_final = ProfileReport(profile)

Error: Error is coming when profile_final is having all categorical variables. I am using pandas profiling version 2.6.
Please note that error is not hitting in following cases:
1- Selecting categorical variables only.
2- if we are not changing the datatypes of columns from objects to category. I have added this steps because i wanted to include a functionality where user could convert selected continuous variable to categorical variables. i tried to change them from continuous to object but as soon as this object variable(say eg: variable having values like 1,2,3,4,1,2,3,4,1,2,3,4 where i want to treat this variable as object) is being used by pandas profiling, it is considering this object variable as numeric in output. but i want to treat it as categories.


Request Method: | POST
-- | --
http://localhost:8000/selected-data/ |  
3.0.5 |  
AssertionError Gaps in blk ref_locs |  
C:\Users\myname\AppData\Local\Continuum\anaconda3\lib\site-packages\pandas\core\internals\managers.py in _rebuild_blknos_and_blklocs, line 231 |  
C:\Users\myname\AppData\Local\Continuum\anaconda3\python.exe |  
3.7.4 |  
['C:\Users\myname\Desktop\EDA Pandas Profiling V4\file-upload', 'C:\Users\myname\AppData\Local\Continuum\anaconda3\python37.zip', 'C:\Users\myname\AppData\Local\Continuum\anaconda3\DLLs', 'C:\Users\myname\AppData\Local\Continuum\anaconda3\lib', 'C:\Users\myname\AppData\Local\Continuum\anaconda3', 'C:\Users\myname\AppData\Local\Continuum\anaconda3\lib\site-packages', 'C:\Users\myname\AppData\Local\Continuum\anaconda3\lib\site-packages\django_crispy_forms-1.9.0-py3.7.egg', 'C:\Users\myname\AppData\Local\Continuum\anaconda3\lib\site-packages\win32', 'C:\Users\myname\AppData\Local\Continuum\anaconda3\lib\site-packages\win32\lib', 'C:\Users\myname\AppData\Local\Continuum\anaconda3\lib\site-packages\Pythonwin', 'C:\Users\myname\AppData\Local\Continuum\anaconda3\lib\site-packages\IPython\extensions']

