edgartools icon indicating copy to clipboard operation
edgartools copied to clipboard

ArrowInvalid: Failed to parse string: 'S L 128' as a scalar of type int32

Open soloist96 opened this issue 1 year ago • 3 comments

Running filings = get_filings() and get the following errors


ArrowInvalid Traceback (most recent call last) Cell In[5], line 1 ----> 1 filings = get_filings() 2 filings

File ~/anaconda3/envs/trading/lib/python3.8/site-packages/edgar/_filings.py:763, in get_filings(year, quarter, form, amendments, filing_date, index) 761 return None 762 try: --> 763 filing_index = get_filings_for_quarters(year_and_quarters, index=index) 764 except httpx.HTTPStatusError as e: 765 if using_default_year and 'AccessDenied' in e.response.text:

File ~/anaconda3/envs/trading/lib/python3.8/site-packages/edgar/_filings.py:389, in get_filings_for_quarters(year_and_quarters, index) 381 """ 382 Get the filings for the quarters 383 :param year_and_quarters: 384 :param index: The index to use - "form", "company", or "xbrl" 385 :return: 386 """ 388 if len(year_and_quarters) == 1: --> 389 _, final_index_table = fetch_filing_index(year_and_quarter=year_and_quarters[0], 390 index=index) 391 else: 392 quarters_and_indexes = parallel(fetch_filing_index, 393 items=year_and_quarters, 394 index=index, 395 threadpool=True, 396 progress=True 397 )

File ~/anaconda3/envs/trading/lib/python3.8/site-packages/edgar/_filings.py:333, in fetch_filing_index(year_and_quarter, index) 331 year, quarter = year_and_quarter 332 url = full_index_url.format(year, quarter, index, "gz") --> 333 index_table = fetch_filing_index_at_url(url, index) 334 return (year, quarter), index_table

File ~/anaconda3/envs/trading/lib/python3.8/site-packages/edgar/_filings.py:355, in fetch_filing_index_at_url(url, index) 352 else: 353 # Read as a fixed width index file 354 file_specs: FileSpecs = form_specs if index == "form" else company_specs --> 355 index_table: pa.Table = read_fixed_width_index(index_text, 356 file_specs=file_specs) 357 return index_table

File ~/anaconda3/envs/trading/lib/python3.8/site-packages/edgar/_filings.py:289, in read_fixed_width_index(index_text, file_specs) 281 arrays = [ 282 pc.utf8_trim_whitespace( 283 pc.utf8_slice_codeunits(array, start=start, stop=stop)) 284 for start, stop, 285 in file_specs.splits 286 ] 288 # Change the CIK to int --> 289 arrays[2] = pa.compute.cast(arrays[2], pa.int32()) 291 # Convert filingdate from string to date 292 # Some files have %Y%m-%d other %Y%m%d 293 date_format = '%Y-%m-%d' if len(arrays[3][0].as_py()) == 10 else '%Y%m%d'

File ~/anaconda3/envs/trading/lib/python3.8/site-packages/pyarrow/compute.py:405, in cast(arr, target_type, safe, options, memory_pool) 403 else: 404 options = CastOptions.safe(target_type) --> 405 return call_function("cast", [arr], options, memory_pool)

File ~/anaconda3/envs/trading/lib/python3.8/site-packages/pyarrow/_compute.pyx:590, in pyarrow._compute.call_function()

File ~/anaconda3/envs/trading/lib/python3.8/site-packages/pyarrow/_compute.pyx:385, in pyarrow._compute.Function.call()

File ~/anaconda3/envs/trading/lib/python3.8/site-packages/pyarrow/error.pxi:155, in pyarrow.lib.pyarrow_internal_check_status()

File ~/anaconda3/envs/trading/lib/python3.8/site-packages/pyarrow/error.pxi:92, in pyarrow.lib.check_status()

ArrowInvalid: Failed to parse string: 'S L 128' as a scalar of type int32

Click to add a cell.

soloist96 avatar May 29 '25 00:05 soloist96

Hello @soloist96 ,

This resembles an issue that happened in the past. From the method signature get_filings(year, quarter, form, amendments, filing_date, index) you seem to be using an older version - 3.x.

What version of the library are you using? Can you update and retry?

dgunning avatar May 29 '25 10:05 dgunning

Thank you @dgunning . I am using version 2.32.0. Is this the latest version?

soloist96 avatar Jun 07 '25 18:06 soloist96

Hey @dgunning , I was able to install the latest 4.1.2 version by cleaning up the conda env. I think the old conda env got messed up a bit. Thanks!

soloist96 avatar Jun 07 '25 21:06 soloist96