Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Python add data to existing table based on existing data

I have data imported in power bi. I want to use one of the columns as input to fetch data from the internet. The data I receive I want to add to anonther (existing table). Something like this:

 

import pandas as pd

df = dataset #Required step in Power BI

gb_list = df['Column2'].T.tolist()
gb_list = list(dict.fromkeys(gb_list))

---Get data from internet ----

---Write result to other table----

df2 = second table
second table.column1 = bla, 
second table.colum2 = blabla
etc
etc

 

 

Can this be done, using Python?

  • Hi, Anonymous 

     

    Could you consider turning off both options in power query?

    And try not to add data sources that you don't want to refresh after publishing to the service.

     

    Did I answer your question? Please mark my reply as solution. Thank you very much.
    If not, please feel free to ask me.

    Best Regards,
    Community Support Team _ Janey

7 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Ok, indeed. Thanks.

    However, I use data from an already existing dataset as variable for my second web query. How can I fetch the data from this first dataset. Sy this would be a table called "test"

     

    I would like to do something like : 

    df = test # my already existing table
    gb_list = df['Column2'].T.tolist()

     

    How can I do that?

    • CNENFRNL's avatar
      CNENFRNL
      Community Champion

      AFAIK, you can't use py to read datasets existing in PBI because they are not stored as separate files.

       

      PQ itself is a powerful ETL tool; I don't see the point resorting to a third-party script to manipulate dataset already existing within PQ.

      gb_list = test['Column2']
      • Anonymous's avatar
        Anonymous
        Not applicable

        What I try to do is scrape a webpage with a lot of data and each time I start PBI I want to add the latest records and not load the everything again because this would take ages. Besides the initial data comes from one webpage and the added data from another. I hope this makes sense.