Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in BI by (11.1k points)

I have integrated python and tableau

 import pandas as pd
    from pandasql import sqldf
    import pandasql as psql

    cars = {'Brand': ['Honda Civic','Toyota Corolla','Ford Focus','Audi A4'],
                'Price': [22000,25000,27000,35000]}
    df = pd.DataFrame(cars)
    
    
    def test_query(df):
        df = pd.DataFrame(df)
        q = """select * from df"""
    
        df2 = psql.sqldf(q, locals())
        return df2

   test_query(df)

I have run the following code and I got an error

Unable to retrieve results for field [{0}]

How can I resolve it? 

1 Answer

0 votes
by (22.5k points)

Check in the code and replace with it

print(test_query(df)[0])

If you want to learn more about it Tableau, then go through this Tableau Training for more insights.     

Browse Categories

...