Skip to main content
Question

Displaying data frame in Python Caller

  • January 29, 2020
  • 1 reply
  • 45 views

Hi there,

I am creating a data frame that has two columns i.e. date and time on Python caller (at init function). I used the "attribute to expose" field to display the value of data frame. When I ran the translation, it made the dataframe column in the output but values were missing. I also tried to display the data frame value using column-wise but no luck. Could anyone tell how to add data frame at the output using Python caller?

1 reply

david_r
Celebrity
  • January 30, 2020

The fmeobjects API only supports the basic Python data types (integer, float, string) when setting FME attributes, e.g.

feature.setAttribute('my_new_attribute'12.3)  # Float = OK
feature.setAttribute('my_new_attribute''This is some text')  # String = OK

The code below would not work, as the fmeobjects API does not know how to handle a DataFrame object:

df = pandas.DataFrame(data=...)
feature.setAttribute('my_new_attribute', df)

If this doesn't answer your question, can you please post the relevant parts of your code?


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings