Job failed: Error in Python process: At line 20: <class 'KeyError'>: wavelength

Solved!
Kay
Level 1
Job failed: Error in Python process: At line 20: <class 'KeyError'>: wavelength

After running the code below. I get the following error. See screenshot.
Attached is also the code
DSS.png

 

# -*- coding: utf-8 -*-
import dataiku
import pandas as pd, numpy as np
from dataiku import pandasutils as pdu
from read_data.read_ftir_data import TransformFTIR

# Read recipe inputs
ftir_first_second_dev = dataiku.Dataset("QC_FTIR_SF_prepared_by_WAVENUMBER_joined_joined_prepared")
ftir_first_second_dev_df = ftir_first_second_dev.get_dataframe()


# Compute recipe outputs from inputs
# TODO: Replace this part by your actual code that computes the output, as a Pandas dataframe
# NB: DSS also supports other kinds of APIs for reading and writing data. Please see doc.



ftir_dev_transform = TransformFTIR(ftir_first_second_dev)
#ftir_dev_tranform.read_ftir_data()
ftir_dev_transform.transform_absorbance()

#ftir_first_second_dev_df = QC_FTIR_SF_prepared_by_WAVENUMBER_joined_joined_prepared_df # For this sample code, simply copy input to output


# Write recipe outputs
ftir_first_second_dev_df = dataiku.Dataset("ftir_first_second_dev_df")
ftir_first_second_dev_df.write_with_schema(ftir_dev_transform.dev_df)
0 Kudos
1 Solution
JordanB
Dataiker

Hi @Kay,

It appears you are importing project library code and the error is coming from the custom code you've added under file name "TransformFTIR". My recommendation would be to review the python job logs (Jobs > Select Failed job > select activity > view full job logs) and find the traceback, which will provide clues as to why you are getting this specific keyerror "wavelength". 

Thanks!

Jordan

View solution in original post

1 Reply
JordanB
Dataiker

Hi @Kay,

It appears you are importing project library code and the error is coming from the custom code you've added under file name "TransformFTIR". My recommendation would be to review the python job logs (Jobs > Select Failed job > select activity > view full job logs) and find the traceback, which will provide clues as to why you are getting this specific keyerror "wavelength". 

Thanks!

Jordan