Skip to main content
Question

Displaying data frame in Python Caller

  • January 29, 2020
  • 1 reply
  • 57 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?

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

1 reply

david_r
Celebrity
  • 8391 replies
  • 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?