Getting Truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all() while python integration

Hi all,

Following is my python script that I am trying to invoke in UiPath. But specifically on this line ‘table = tabulate(data,tablefmt=“plain”)’ it is throwing me error that Truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all(). Anyone knows how to resolve this problem?

import sys
from tabula import read_pdf
from tabulate import tabulate
import pandas as pd
import io

def pdf_to_csv(file_path):
  # Read the only the page n°6 of the file
  data = read_pdf(file_path,pages = 'all',multiple_tables = True,stream = True,area=(94.03, 65.9,496.1, 969.36))
  # Transform the result into a string table format
  table = tabulate(data,tablefmt="plain")

  # Transform the table into dataframe
  df = pd.read_fwf(io.StringIO(table))

  df.to_csv('temp.csv',index=False,index_label=False,header=False)

Thanks in advance!

@Umer_Shahid

I believe in this context you have to define headers as well…

This error generally occurs when a boolean is masked…so try with adding headers as well

Cheers