Pandas in python script

Hi,

I am trying to use the Pandas library in my python 3 script. However, when importing there is an error stating that the pandas module is not found. In my Connection I did make sure to add pandas as a third party module.

How can I go about getting pandas?

Thank you.

Hi @achintya_kumar - can you paste a snippet of your Python3 Script input? In order for imports to work properly within the action, all imports must be done within the ‘run’ function.

Here is where I use a 3rd party module:
image

And here is my code (just importing it fails with no module named pandas error):

def run(params={}):

    import pandas as pd

    rawData = pd.read_csv(params.get("string_CSV"))

return {}

@achintya_kumar - thank you for the reply! Your code checks out - the import is correct as is your connection configuration. Can you verify that the connection test for your connection was successful? It may help to create a new connection and then view the connection test log for that new connection.

The third-party modules are installed during the connection test, so if there is a failure during the connection test then that will explain why you are seeing that error message. Let me know if you need assistance viewing the connection test log, but in the meantime here is a link to the InsightConnect documentation around running and viewing connection tests: https://insightconnect.help.rapid7.com/docs/test-a-connection.

When I tested the connection to the container and it found no issues. However restarting the container seems to have fixed the issue.

1 Like