Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 pandas.read_sas with chunksize: IndexError list index out of range
Good morning,

I have read the rules about posting but i cannot attach a sample of my data or reproduce the entire error message as the data i am working on is located on a server without access to internet. I apologise for this inconvenience. I'll try to reproduce most of what is requested however below.

I am working with very big sas files (data on each job, hence millions of lines) and got memory error when i was trying to simple read them (they open fine in R or stata strangely). Therefore i searched and find the pandas.read_sas option to work with chunks of the data. My code is now the following:

df_chunk = pd.read_sas(r'file.sas7bdat', chunksize=500)

for chunk in df_chunk:  

At this point i get the following error (I am reproducing it here manually as i cannot copy paste):

line 660, in _chunk_to_dataframe if self.column_formats[j] in const.sas_date_formats: IndexError: list index out of range
Looking deeper in the error message, the issue seems to be in the underlying function "
" in the following line :
if self.column_formats[j] in const.sas_date_formats 
Many thanks for your help,

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  Getting Index Error - list index out of range RahulSingh 2 297 Feb-03-2020, 07:17 AM
Last Post: RahulSingh
  itertuples, datetime, pandas, groupby, in range karlito 0 516 Nov-29-2019, 11:35 AM
Last Post: karlito
  iterate over index and define each range as a day karlito 7 409 Nov-19-2019, 06:37 AM
Last Post: karlito
  How to speed up work with pandas index? AlekseyPython 1 264 Oct-16-2019, 02:06 PM
Last Post: AlekseyPython
  IndexError: index out of bounds LeoGER 3 1,295 Sep-05-2019, 02:05 PM
Last Post: LeoGER
  Applying operation to a pandas multi index dataframe subgroup Nuovoq 1 578 Sep-04-2019, 10:04 PM
Last Post: Nuovoq
  pandas: can we look for the index of a string paul18fr 2 498 Jul-31-2019, 08:25 AM
Last Post: paul18fr
  Inserting data from python list into a pandas dataframe mahmoud899 0 556 Mar-02-2019, 04:07 AM
Last Post: mahmoud899
  Can you help me with this error? IndexError: invalid index of a 0-dim tensor. DerBerliner 1 1,266 Feb-28-2019, 05:47 PM
Last Post: Larz60+
  Index in Python list contains multiple elements.How to access each val and pass them Shameendra 1 659 Nov-30-2018, 05:41 PM
Last Post: wavic

Forum Jump:

Users browsing this thread: 1 Guest(s)