Alteryx Designer Desktop Discussions

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

Python tool

Eneida33
7 - Meteor

Hello,

 

I am using a python tool to start a workflow. I copied the content from  Jupyter Notebook and pasted it in my configuration window. 

I pressed run and the data was there.

Today I am trying to continue my workflow and this error comes up. 

---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
<ipython-input-1-4f9ee2ade530> in <module>
     23 
     24 df = pd.json_normalize(r["submissions"])
---> 25 data = df[FIELDS]
     26 
     27 col_names = ["How satisfied were you  with the below elements of the 'I Am Ready' online session?",

c:\users\....\appdata\local\alteryx\bin\miniconda3\envs\designerbasetools_venv\lib\site-packages\pandas\core\frame.py in __getitem__(self, key)
   2903             if is_iterator(key):
   2904                 key = list(key)
-> 2905             indexer = self.loc._get_listlike_indexer(key, axis=1, raise_missing=True)[1]
   2906 
   2907         # take() does not accept boolean indexers

c:\users\.....\appdata\local\alteryx\bin\miniconda3\envs\designerbasetools_venv\lib\site-packages\pandas\core\indexing.py in _get_listlike_indexer(self, key, axis, raise_missing)
   1252             keyarr, indexer, new_indexer = ax._reindex_non_unique(keyarr)
   1253 
-> 1254         self._validate_read_indexer(keyarr, indexer, axis, raise_missing=raise_missing)
   1255         return keyarr, indexer
   1256 

c:\users\.....\appdata\local\alteryx\bin\miniconda3\envs\designerbasetools_venv\lib\site-packages\pandas\core\indexing.py in _validate_read_indexer(self, key, indexer, axis, raise_missing)
   1296             if missing == len(indexer):
   1297                 axis_name = self.obj._get_axis_name(axis)
-> 1298                 raise KeyError(f"None of [{key}] are in the [{axis_name}]")
   1299 
   1300             # We (temporarily) allow for some missing keys with .loc, except in

KeyError: "None of [Index(['data.109478467.value', 'data.109478468.value', 'data.109478469.value',\n       'data.109478470.value', 'data.109478471.value', 'data.109478472.value'],\n      dtype='object')] are in the [columns]"

 

How could I fix it?

 

Thank you 

2 REPLIES 2
atcodedog05
22 - Nova
22 - Nova

Hi @Eneida33 

 

Print df after below step to check whether is ha the field column

df = pd.json_normalize(r["submissions"])
df

 

data = df[FIELDS]

Hope this helps : ) 

Eneida33
7 - Meteor

Hi,

 

I cannot print df. I do not have access to jupyter. 

I am really stacked and completely new to alteryx.

😂 

Labels