I. A
I. A

Reputation: 2312

Visualization using Desktop Power BI, Python and flask

I am using flask to create a web api from python functions. My code:

from flask import Flask, render_template
import pandas as pd
import numpy as np


app = Flask(__name__)

@app.route("/store_on_promo_df")
def store_on_promo_df():

    data_df = pd.read_csv(data_path, header=0)

    is_on_promo_series = data_df['IsPromo'] == True
    data_on_promo_df = data_df.loc[is_on_promo_series]

    return data_on_promo_df

Consequently, I would like to have some visualization in Power BI. Therefore, I am using import data from web option in power BI.

Problem: I cannot return a dataframe using flask. And I am not sure what to return so that PowerBI reads my data properly.

Finally, please note that this is helpful in my case because I want to share big data with other teams at different location.

Any help is much appreciated!

Upvotes: 0

Views: 1279

Answers (1)

LNF
LNF

Reputation: 709

I have no experience with Power BI but with a small research, here is how you probably can do it.

Return your data as JSON format and look at this tutorial to add your endpoint to Power BI.

Upvotes: 1

Related Questions