Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Python visual is not accurate

The matplotlib plot that shows up in Power BI, is different from that one, that the same code generates in a jupyter notebook.

Please help.

  • Anonymous's avatar
    Anonymous
    5 years ago

    Thank you Pragati11  and amitchandak .

    The issue was with the sequence of columns. Power BI sends the columns in the alphabetical order, and not in the order in which the columns get uploaded.

    Thanks again for your prompt support.

14 Replies

    • Anonymous's avatar
      Anonymous
      Not applicable

      amitchandak wrote:

      Anonymous, can share some sample images?


      Thank you for the prompt response Amit.
       
      This is the code:
      import pandas as pd
      import pickle
      import matplotlib.pyplot as plt

      enq_loaded_model = pickle.load(open('C:ENQUIRY.sav', 'rb'))
      y = enq_loaded_model.predict(dataset)
      plt.plot(y)
      plt.show()
       
      First one is from Power BI, and the second one from jupyter notebook
      • Pragati11's avatar
        Pragati11
        Super User

        Hi Anonymous ,

         

        I can see the difference clearly in the y-axis scaling.

        In Jupyter your y-axis range is till 2200, thereore the graph shows a different pattern.

        In Power BI your y-axis range is till 2950, therefore graph is different.

         

        In your pythin script when you are generating plot in Power BI, you will have to define range for your y-axis. Try giving this range similar to that in Jupyter notebook. I am sure you will get the same graph.

         

        Thanks,

        Pragati

  • Hi Anonymous ,

     

    Can you share some screenshots here please with the following:

    1. Screenshot of scripts used in Jupyter and Power BI
    2. Screenshots of graph that is generated in Jupyter and Power BI

    Thanks,

    Pragati

  • Anonymous's avatar
    Anonymous
    Not applicable

    Thank you Pragati11  and amitchandak .

    The issue was with the sequence of columns. Power BI sends the columns in the alphabetical order, and not in the order in which the columns get uploaded.

    Thanks again for your prompt support.