In case you missed the announcement: The Alteryx One Fall Release is here! Learn more about the new features and capabilities here
ACT NOW: The Alteryx team will be retiring support for Community account recovery and Community email-change requests Early 2026. Make sure to check your account preferences in my.alteryx.com to make sure you have filled out your security questions. Learn more here
Start Free Trial

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Alteryx Python Import Error, How to install module in alteryx python?

wonka1234
10 - Fireball

Hi,

 

I am getting the error:

 


ImportError
: Missing optional dependency 'xlrd'. Install xlrd >= 1.0.0 for Excel support Use pip or conda to install xlrd.

 

my code:

 

from ayx import Alteryx


import pandas as pd
import zipfile


archive = zipfile.ZipFile(r'O:\Alteryx\Original - All fields - October 2022.zip')
xlfile = archive.open('Original - All fields - October 2022.xls')

df = pd.concat(pd.read_excel(xlfile, header = 1, sheet_name=None), ignore_index=True)

Alteryx.write(df, 1)

 

However I have this module installed on my python on pc and the code runs fine locally. 

 

Why doesnt this work in alteryx python tool?

 

Thanks.

11 REPLIES 11
wonka1234
10 - Fireball

No it didnt - I think for some reason it is not being read in as a DF. Getting this at the bottom

KeyError: 0 

  and when i run your code:

 

ERROR: Alteryx.write(pandas_df, outgoing_connection_number):
Currently only pandas dataframes can be used to pass data to outgoing connections in Alteryx

 

TypeError: Currently only pandas dataframes can be used to pass data to outgoing connections in Alteryx
IraWatt
17 - Castor
17 - Castor

pd.read_excel should always return a DataFrame pandas.read_excel — pandas 1.5.2 documentation (pydata.org). You can check if it is a dataframe by doing things like this: python - Testing if a pandas DataFrame exists - Stack Overflow. Does this work:

pd.read_excel(xlfile, header = 1, sheet_name=None).head()

 

Labels
Top Solution Authors