Bug in loop for for pandas qcut
See original GitHub issueDescription
What steps will reproduce the problem?
I have a list containing my dataframes, from which i iterate to binarize some columns. The loop, binarizes and change the values in column:
for k,i in enumerate(datasetlist): print(k) for j in range(0,len(i.columns)): if type(i.iloc[0,j])!=str: i.iloc[:,j]=pd.qcut(i.iloc[:,j],10,duplicates=‘drop’)
After the loop, running “datasetlist[12]” gives me the anwer i’m expecting. But running the extensive name of the dataframe or view the dataframe in explorer, it is the old dataframe without changes.
Versions
- Spyder version: 4.2.3
- Python version: 3.8.8
- Qt version: 5.9.7
- PyQt5 version: 5.9.2
- Operating System: Windows 10
Dependencies
# Mandatory:
atomicwrites >=1.2.0 : 1.4.0 (OK)
chardet >=2.0.0 : 4.0.0 (OK)
cloudpickle >=0.5.0 : 1.6.0 (OK)
diff_match_patch >=20181111 : 20200713 (OK)
intervaltree >=3.0.2 : 3.1.0 (OK)
IPython >=7.6.0 : 7.21.0 (OK)
jedi =0.17.2 : 0.17.2 (OK)
jsonschema >=3.2.0 : 3.2.0 (OK)
keyring >=17.0.0 : 22.3.0 (OK)
nbconvert >=4.0 : 6.0.7 (OK)
numpydoc >=0.6.0 : 1.1.0 (OK)
paramiko >=2.4.0 : 2.7.2 (OK)
parso =0.7.0 : 0.7.0 (OK)
pexpect >=4.4.0 : 4.8.0 (OK)
pickleshare >=0.4 : 0.7.5 (OK)
psutil >=5.3 : 5.8.0 (OK)
pygments >=2.0 : 2.8.1 (OK)
pylint >=1.0 : 2.5.2 (OK)
pyls >=0.36.2;<1.0.0 : 0.36.2 (OK)
pyls_black >=0.4.6 : 0.4.6 (OK)
pyls_spyder >=0.3.2 : 0.3.2 (OK)
qdarkstyle >=2.8 : 2.8.1 (OK)
qtawesome >=0.5.7 : 1.0.2 (OK)
qtconsole >=5.0.1 : 5.0.2 (OK)
qtpy >=1.5.0 : 1.9.0 (OK)
rtree >=0.8.3 : 0.9.4 (OK)
setuptools >=39.0.0 : 52.0.0.post20210125 (OK)
sphinx >=0.6.6 : 3.5.2 (OK)
spyder_kernels >=1.10.2;<1.11.0 : 1.10.2 (OK)
textdistance >=4.2.0 : 4.2.1 (OK)
three_merge >=0.1.1 : 0.1.1 (OK)
watchdog >=0.10.3;<2.0.0 : 1.0.2 (OK)
zmq >=17 : 20.0.0 (OK)
# Optional:
cython >=0.21 : 0.29.22 (OK)
matplotlib >=2.0.0 : 3.3.4 (OK)
numpy >=1.7 : 1.20.1 (OK)
pandas >=1.1.1 : 1.2.3 (OK)
scipy >=0.17.0 : 1.6.1 (OK)
sympy >=0.7.3 : 1.7.1 (OK)
# Spyder plugins:
spyder_notebook : 0.3.2 (OK)
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
How to resolve Pandas pd.Cut having Error / Bug?
Ok i resolved my problem. By installing Python 64bit . now no problem. Previously it have 32 bit python . My system is...
Read more >Appending Pandas dataframes in for loop results in ValueError
It seems to be a bug so I am posting here as well. I want to generate a dataframe that is created by...
Read more >You Don't Always Have to Loop Through Rows in Pandas!
A look at alternatives to “for loops” with Pandas' built-in vectorized solutions when working with a DataFrame.
Read more >How to use pandas cut() and qcut()? - GeeksforGeeks
We can use the 'cut' function in broadly 2 ways: by specifying the number of bins directly and let pandas do the work...
Read more >What's new in 1.1.0 (July 28, 2020) - Pandas
Bug in arithmetic operations between DataFrame objects with non-overlapping columns with duplicate labels causing an infinite loop (GH35194).
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yes.
Perfect! I’m closing this issue then.
Thanks for reporting!