Question

Displaying data frame in Python Caller

  • 29 January 2020
  • 1 reply
  • 5 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

Userlevel 4

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?

Reply