The latest version of pandas 0.9.0 is installed if it was an error. EDIT: forgot to mention that this is Python 2.7. Trying to read an Excel file. This part looks fine. Initially, I tried to use iteritems () for each line of the pandas frame, since id_company had to be checked based on mysql (the code did not turn on). The same / similar error message putting it in a tuple (code below). An error message will appear.
Note that .reindex () exists, but it did not work before. Reindex () was a kind of hail mara.
As a job, I'm probably going to just import from my target sql and make a connection. I am worried about the size of the datasets.
import pandas as pd def runNow(): #identify sheet source = 'C:\Users\jlalonde\Desktop\startup_geno\startupgenome_w_id_xl_20121109.xlsx' xls_file = pd.ExcelFile(source) sd = xls_file.parse('Sheet1') source_u = sd.drop_duplicates(cols = 'id_company', take_last=False) source_r = source_u[['id_company','id_good','description', 'website','keyword', 'company_name','founded_month', 'founded_year', 'description']] source_i = source_r.reindex() #hail mary tup_r = [tuple(x) for x in source_i.values]
Here is the error:
Traceback (most recent call last): File "<pyshell#10>", line 1, in <module> sg_sql_2.runNow() File "sg_sql_2.py", line 31, in runNow tup_r = [tuple(x) for x in source_r.values] File "C:\Python27\lib\site-packages\pandas\core\frame.py", line 1443, in as_matrix return self._data.as_matrix(columns).T File "C:\Python27\lib\site-packages\pandas\core\internals.py", line 723, in as_matrix mat = self._interleave(self.items) File "C:\Python27\lib\site-packages\pandas\core\internals.py", line 743, in _interleave indexer = items.get_indexer(block.items) File "C:\Python27\lib\site-packages\pandas\core\index.py", line 748, in get_indexer raise Exception('Reindexing only valid with uniquely valued Index ' Exception: Reindexing only valid with uniquely valued Index objects
So, after I hit my head against the wall for most of the day, can someone tell me if this is a mistake, or if I am missing something really obvious?