Skip to main content
Question

python function call giving bot error

  • 10 June 2024
  • 3 replies
  • 65 views

Hi Everyone,

I am trying to Import .py file and Execute function using A360 it is throwing BOT error but same python code is perfectly working fine in pycharm editor, Any suggestions will be highly appreciated

 

 

3 replies

Userlevel 1
Badge +3

Hi @bhargavi.B ,

 

Try with below code.

********************************

import pandas as pd

def CompareExcel():
    
    df1 = pd.read_csv('Input_Dump - Copy1.csv', encoding='cp1252')
    df2 = pd.read_csv('Input_Dump - Copy2.csv', encoding='cp1252')

    # Perform comparison
    result = df1[~df1.apply(tuple).isin(df2.apply(tuple))]

    # Export result to 'Output.csv'
    result.to_csv('Output.csv', index=False)

    return result

# Call the function
output_data = CompareExcel()
print(output_data)  # Optional: Print the result for verification

 

************************************
 

Badge +1

Hi @DK 964 ,

Thanks for your Investigation,

As suggested, I tried below Python Snippet but still same BOT error when i am trying to execute same code snippet in PyCharm it is perfectly working fine snapshots as below, Thanks in advance….

 

Badge +2

Hello. It’s because you don’t have pandas saved in the correct directory. When you create a py script in pycharm it downloads all dependencies locally to that project. In order to have AA run your pyscript all dependencies have to be saved globally. I think you can open cmd and run a line like “pip install pandas” on your user level and you should be good to go. Should be stored in this location I think c:\program files\python38\lib\site-packages. Hopefully this helps!

Reply