Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Designer Desktop Discussions

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

Unable to compare data frame using python Tool

NamrataDhiwar
8 - Asteroid

Hello,

 

I have executed the python with Pycharm and Jupyter Notebook tool as well as Python Exe using Run command from Alteryx. 

The Script executed successfully.

 

But when i am trying to run the exact same code using python its gives me error.

 

I am trying to compare two data frames with below code

comparision=df1.values==df2.values

rows,cols=np.where(comparision=='False')

 

This code executed in all the IDEs. but using Python Tool it is showing error as below

 

Error: elementwise comparison failed this will raise an error in the future

ValueError: not enough values to unpack (expected 2, got 1)

 

Please help to resolve the issue

5 REPLIES 5
PhilipMannering
16 - Nebula
16 - Nebula

This worked for me (see screenshot). I think you will need to share your workflow as I can't reproduce your error. Either that or a few screenshots including your inputs.

 

PhilipMannering_0-1657976585091.png

 

NamrataDhiwar
8 - Asteroid

I am using below code to compare two excels

 

df1=pd.read_excel('File1.xlsx')
df2=pd.read_excel('File2.xlsx')

df1.equals(df2)

comparison_values = df1.values == df2.values
print (comparison_values)

import numpy as np
rows,cols=np.where(comparison_values==False)
PhilipMannering
16 - Nebula
16 - Nebula

That's not what I asked for. I need to know what the dataframes look like to be able to help.

NamrataDhiwar
8 - Asteroid
Emp NameTest
ABC123
XYZ345

 

I am using engine=Openpyxl while reading xlsx file

 

df1=pd.read_excel('File1.xlsx',engine='openpyxl')
df2=pd.read_excel('File2.xlsx',engine='openpyxl')

 

PhilipMannering
16 - Nebula
16 - Nebula

Ah, I see. And what does,

df1.shape

and

df2.shape

 

Give you if you run this after reading the Excel?

Labels