Return Pandas dataframe as JSONP response in Python Flask
This is my solution to convert a Pandas dataframe to JSONP an return it in Flask:
from flask_jsonpify import jsonpifydf_list = df.values.tolist()JSONP_data = jsonpify(df_list)return JSONP_data
Depending on how you need the dataframe converted, you might need to create the list in a different way. For example like this:
df_list = merged.values.T.tolist()
Or like this:
df_list = list(df.values.flatten())
Thanks goes to the user @Barmer