Bring your best ideas to the AI Use Case Contest! Enter to win 40 hours of expert engineering support and bring your vision to life using the powerful combination of Alteryx + AI. Learn more now, or go straight to the submission form.
Start Free Trial

Alteryx Designer Desktop Discussions

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

Fonction python "struct" argument "f" (float) pour transposer de l'hexadécimal en float

ClementSo
8 - Asteroid

Bonjour,

 

Je souhaite pourvoir transposer de l'héxadécimal en float avec Alteryx.

La fonction HEXTODEC fonctionne uniquement si le chiffre est entier.

 

Avec python j'utilise la fonction "struct" pouis l'argument "f" pour du float et j'obtiens un résultat correct que le nombre soit entier ou à virgule.

 

pip install python_struct
import struct
struct.unpack('!f', bytes.fromhex('valeur à renseigner'))[0]

 

Auriez-vous une fonction à me soumettre pour répondre à cette problématique ?

Une sorte de fonction struct de python pour Alteryx.

 

Je ne souhaite pas passer par l'outil python pour réaliser cette transposition hexadécimal en Float.

 

Merci,

2 REPLIES 2
ClementSo
8 - Asteroid

Bonjour,
J'ajoute qu'avec l'outil python je saisie le code suivant :

 

from ayx import Alteryx
from struct import unpack # standard

df=Alteryx.read("#12")

df['results'] = df['trans_py'].apply (lambda hex: unpack('>d', bytes.fromhex(hex))[0])

Alteryx.write(df,1)

 

la conséquence c'est qu'Alteryx designer plante, j'ai l'impression qu'il n'arrive pas à traiter les 35 000 lignes.

 

Pourriez-vous m'aider ?

 

Merci,

PhilipMannering
16 - Nebula
16 - Nebula

Apologies if I did not translate correctly....

 

I'm not sure why you can't use HexToNumber() function,

PhilipMannering_0-1655796559318.png

 

 

Or in Python,

PhilipMannering_1-1655796632365.png

 

Labels
Top Solution Authors