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

fix chunk method "Table" losing content when the Excel file has multi… #4123

Merged
merged 1 commit into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix chunk method "Table" losing content when the Excel file has multi…
…ple sheets
  • Loading branch information
ly0303521 committed Dec 19, 2024
commit ad4bd397ce5e77e1bbc6c23cc4e126c5f59cdaf5
2 changes: 1 addition & 1 deletion deepdoc/parser/excel_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def row_number(fnm, binary):
for sheetname in wb.sheetnames:
ws = wb[sheetname]
total += len(list(ws.rows))
return total
return total

if fnm.split(".")[-1].lower() in ["csv", "txt"]:
encoding = find_codec(binary)
Expand Down
2 changes: 2 additions & 0 deletions rag/app/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ def __call__(self, fnm, binary=None, from_page=0,
continue
data.append(row)
done += 1
if np.array(data).size == 0:
continue
res.append(pd.DataFrame(np.array(data), columns=headers))

callback(0.3, ("Extract records: {}~{}".format(from_page + 1, min(to_page, from_page + rn)) + (
Expand Down