Python Forum

Full Version: function returns dataframe as list
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello, I have a function that takes a dataframe as an argument and returns a modified dataframe; and the modified dataframe is a dataframe object as checked with isinstance before return. However, in the calling function the variable assigned to the returned dataframe is no longer a dataframe but a list. Any ideas why would that be? Thanks!
(Aug-13-2022, 08:04 PM)harum Wrote: [ -> ]Hello, I have a function that takes a dataframe as an argument and returns a modified dataframe; and the modified dataframe is a dataframe object as checked with isinstance before return. However, in the calling function the variable assigned to the returned dataframe is no longer a dataframe but a list. Any ideas why would that be? Thanks!


If anyone is interested, it was a newbie mistake, used "return [dataframe_name]" instead of "return dataframe_name".
(Aug-13-2022, 08:19 PM)harum Wrote: [ -> ]used "return [dataframe_name]"

Yes, that would do it.

Good that you worked it out: that's learning, right there.