Getting prep int not defined error in tableau prep

0 votes

I'm using Tableau Prep with Python Script, however when I run the Python Script, I receive an error that says "prep int() function is not defined" in the Output Flow. For the get output schema function, I used prep int() in Python Script.

import pandas as pd
import requests
import json

df = pd.read_csv("E:/dummy.csv")
port = "8080"

target_columns = ["id"]
# target_columns = df['id']
source_columns = list(set(df.columns) - {"target"})
# print(target_columns)

target_json = json.loads(df[target_columns].to_json(orient="records"))
source_json = json.loads(df[source_columns].to_json(orient="records"))

# print(source_json)

payload = {"source": {"data": source_json}, "target": {"data": target_json}}
# print(payload)
# Run a single or mini-batch prediction
headers = {"content-type": "application/json", "accept": "application/json"}

r = requests.post(
    "http://14.141.154.146:9871/invocations", data=json.dumps(payload), headers=headers
)

# print(r.text)
def filldata():
    df = pd.DataFrame()
    ID(int)
    # fill df up with data
    # for example
    # name (string)
    # time (datetime)
    # number (int)

    return df
def get_output_schema(self):
    return pd.DataFrame({"ID": prep_int()})

Mar 2, 2022 in Tableau by Vaani
• 7,070 points
722 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In Tableau

0 votes
1 answer

Error: Comaparing date value with YEAR in Tableau

You have to ensure that the comparisons ...READ MORE

answered Jul 11, 2018 in Tableau by ffdfd
• 5,550 points
667 views
0 votes
1 answer

Not able to publish workbook in Tableau Server after upgrading it from Tableau 9.1 to 9.2

Following is a little hack that will ...READ MORE

answered Jun 19, 2018 in Tableau by xyz
• 1,560 points
1,137 views
0 votes
1 answer

Hive tables are not available in tableau

I have the same issue with Tableau ...READ MORE

answered Jun 27, 2018 in Tableau by Atul
• 10,240 points
1,466 views
0 votes
1 answer

Using Regex in Tableau, but only getting Null values.

Tableau regex engine is ICU, and there ...READ MORE

answered Aug 17, 2018 in Tableau by AwesomeSauce
• 860 points
911 views
0 votes
1 answer

In Tableau, how to pass measure/dimension to action filters that are not in the chart?

Hi Sindhu,  You can choose the fields that are ...READ MORE

answered Mar 11, 2019 in Tableau by Cherukuri
• 33,030 points
5,536 views
0 votes
1 answer

Return rows with not null values in Tableau

Hi Nithin, You can add a calculated field ...READ MORE

answered Apr 10, 2019 in Tableau by Cherukuri
• 33,030 points
5,874 views
0 votes
2 answers
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 7, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 4,434 views
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP