question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

IndexingError: Too many indexers

See original GitHub issue

Using example code:

import pandas as pd
import prince

df = pd.read_csv('ogm.csv')
mca = prince.MCA(df, n_components=-1)
mca.plot_rows(show_points=True, show_labels=False, color_by='Position Al A', ellipse_fill=True)

Error:

Traceback (most recent call last):
  File "test.py", line 6, in <module>
    mca.plot_rows(show_points=True, show_labels=False, color_by='Position Al A', ellipse_fill=True)
  File "/Users/hewgreen/anaconda/lib/python3.6/site-packages/prince/mca.py", line 154, in plot_rows
    ellipse_fill=ellipse_fill
  File "/Users/hewgreen/anaconda/lib/python3.6/site-packages/prince/plot/mpl/pca.py", line 30, in row_principal_coordinates
    data = principal_coordinates.iloc[:, axes].copy() # Active rows
  File "/Users/hewgreen/anaconda/lib/python3.6/site-packages/pandas/core/indexing.py", line 1325, in __getitem__
    return self._getitem_tuple(key)
  File "/Users/hewgreen/anaconda/lib/python3.6/site-packages/pandas/core/indexing.py", line 1662, in _getitem_tuple
    self._has_valid_tuple(tup)
  File "/Users/hewgreen/anaconda/lib/python3.6/site-packages/pandas/core/indexing.py", line 189, in _has_valid_tuple
    if not self._has_valid_type(k, i):
  File "/Users/hewgreen/anaconda/lib/python3.6/site-packages/pandas/core/indexing.py", line 1599, in _has_valid_type
    return self._is_valid_list_like(key, axis)
  File "/Users/hewgreen/anaconda/lib/python3.6/site-packages/pandas/core/indexing.py", line 1648, in _is_valid_list_like
    raise IndexingError('Too many indexers')
pandas.core.indexing.IndexingError: Too many indexers

I tried to find some details about how to fix myself to no avail. Many thanks in advance for your help.

Regards

hewgreen

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:18 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
naokocommented, Apr 3, 2018

My apologies. I re-installed the latest and example ran smoothly. Thank you for your quick response. All good. Finally thank you for your great work.

0reactions
blu3r4ycommented, Feb 7, 2020

@Sunil4423 There is an error in your code on line 2 - not in prince. Re-investigate your stack trace.

Read more comments on GitHub >

github_iconTop Results From Across the Web

"Too many indexers" with DataFrame.loc - Stack Overflow
Pandas gets confused sometimes when indexes are similar or contain similar values. If you were to have a column named 'C1' or something...
Read more >
Wrong "Too many indexers" error message when ... - GitHub
I don't think this should ever raise a "IndexingError: Too many indexers" as you actually have a length 2 indexer (so suits the...
Read more >
pandas.core.indexing.IndexingError: Too many ... - YouTube
Pandas : pandas.core.indexing. IndexingError : Too many indexers [ Beautify Your Computer : https://www.hows.tech/p/recommended.html ] Pandas ...
Read more >
pandas.errors.IndexingError — pandas 1.5.2 documentation
IndexingError : Too many indexers >>> df[pd.Series([True], dtype=bool)] ... # IndexingError: Unalignable boolean Series provided as indexer... >>> s = pd.
Read more >
pandas.core.indexing.IndexingError: Too many indexers-pandas
django. My goal is to take out the numerical value but I do not know how to set the index properly. What I...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found