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

AttributeError: 'BlockManager' object has no attribute 'T' #3

Closed
cm3 opened this issue Jan 7, 2017 · 3 comments
Closed

AttributeError: 'BlockManager' object has no attribute 'T' #3

cm3 opened this issue Jan 7, 2017 · 3 comments
Labels

Comments

@cm3
Copy link
Owner

cm3 commented Jan 7, 2017

df.set_value(i, 'thumbnail', filename)

cause error in some rows:

Traceback (most recent call last):
  File "get_thumbnail.py", line 63, in main
    df.set_value(i, 'thumbnail', filename)
  File "/home/kameda/bin/miniconda3/lib/python3.5/site-packages/pandas/core/frame.py", line 1924, in set_value
    series = self._get_item_cache(col)
  File "/home/kameda/bin/miniconda3/lib/python3.5/site-packages/pandas/core/generic.py", line 1387, in _get_item_cache
    res = self._box_item_values(item, values)
  File "/home/kameda/bin/miniconda3/lib/python3.5/site-packages/pandas/core/frame.py", line 2396, in _box_item_values
    return self._constructor(values.T, columns=items, index=self.index)
AttributeError: 'BlockManager' object has no attribute 'T'
@cm3 cm3 added the bug label Jan 7, 2017
@cm3
Copy link
Owner Author

cm3 commented Jan 7, 2017

use

df.loc[i, 'thumbnail'] = filename

instead

@cm3 cm3 closed this as completed Jan 7, 2017
@cm3
Copy link
Owner Author

cm3 commented Jan 8, 2017

Typical reason of this error is duplicate column names.

Csv output with unnamed index can have caused that. Now, csv is output without the index column.

df.to_csv(csv, encoding="utf-8", index=False)

Ref:

@AlecMurphy
Copy link

I think this also solved my 'Incompatible Indexer with Series' error. I'm not positive what it was but my issue was:

  1. Concat two data frames
  2. Take data from column of one frame and move it to column of the other
    • Did this using the df.iloc[n, 'Column Name'] = df.iloc[n, 'Other Column Name'] loop
      I wasn't able to get the above to work and for some reason one column would randomly be a series or a data frame type. Using set_value resulted in the BlockManager error.

I re imported the data making sure to specify encoding on each (used utf-8), made sure there where no duplicate column names in the data sets, and now everything behaves as normal! Guess that's what I get for assuming, implicit < explicit when it comes to pandas!!!! Specify your encoding, keep unique names, and remember identity vs equality !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants