semeval_id
int32
0
319
question
stringlengths
23
161
dataset
stringclasses
16 values
split
stringclasses
1 value
predicted_type
stringclasses
5 values
predicted_columns
stringlengths
6
161
phase
stringclasses
1 value
content
stringlengths
2.99k
55.1k
update_timestamp
stringclasses
15 values
200
Are all transactions IDs unique?
060_Bakery
dev
boolean
[Transaction]
dev
# Instructions: Generate ONLY python code. Do not include explanations. # you can use pandas and numpy. Use the meta data information from df_schema, df_descprtion. import pandas as pd import numpy as np # Description of dataframe schema. df_schema = { "columns": [ { "name": "Transaction", "type": "uint16" }, { "name": "Item", "type": "category" }, { "name": "date_time", "type": "category" }, { "name": "period_day", "type": "category" }, { "name": "weekday_weekend", "type": "category" } ] } # Description of dataframe columns. df_descrption = { "count":{ "Transaction":20507.0 }, "mean":{ "Transaction":4976.2023699225 }, "std":{ "Transaction":2796.203001082 }, "min":{ "Transaction":1.0 }, "25%":{ "Transaction":2552.0 }, "50%":{ "Transaction":5137.0 }, "75%":{ "Transaction":7357.0 }, "max":{ "Transaction":9684.0 } } # Randome sample of 10 rows from the dataframe. df_random_sample = { "count":{ "Transaction":20507.0 }, "mean":{ "Transaction":4976.2023699225 }, "std":{ "Transaction":2796.203001082 }, "min":{ "Transaction":1.0 }, "25%":{ "Transaction":2552.0 }, "50%":{ "Transaction":5137.0 }, "75%":{ "Transaction":7357.0 }, "max":{ "Transaction":9684.0 } } ''' The question categories are: - boolean: Valid answers include True/False, Y/N, Yes/No (all case insensitive). - category: A value from a cell (or a substring of a cell) in the dataset. - number: A numerical value from a cell in the dataset, which may represent a computed statistic (e.g., average, maximum, minimum). - list[category]: A list containing a fixed number of categories. The expected format is: "['cat', 'dog']". Pay attention to the wording of the question to determine if uniqueness is required or if repeated values are allowed. - list[number]: Similar to list[category], but with numbers as its elements. ''' # TODO: complete the following function in one line, by completing the return statement. It should give the answer to: How many rows are there in this dataframe? def example(df: pd.DataFrame): df.columns=["A"] # Expected output type: is number, this will be checked. return df.shape[0] # It should give the answer to: Are all transactions IDs unique? # The answer should only contain python code, you are not allowed leave any TODO undone. def answer(df: pd.DataFrame): # Use df to answer: Are all transactions IDs unique? df.columns = ['Transaction', 'Item', 'date_time', 'period_day', 'weekday_weekend'] # Expected output type: is boolean, this will be checked. return
20250129013723
201
Is there any transaction that took place during the night?
060_Bakery
dev
boolean
[period_day]
dev
# Instructions: Generate ONLY python code. Do not include explanations. # you can use pandas and numpy. Use the meta data information from df_schema, df_descprtion. import pandas as pd import numpy as np # Description of dataframe schema. df_schema = { "columns": [ { "name": "Transaction", "type": "uint16" }, { "name": "Item", "type": "category" }, { "name": "date_time", "type": "category" }, { "name": "period_day", "type": "category" }, { "name": "weekday_weekend", "type": "category" } ] } # Description of dataframe columns. df_descrption = { "count":{ "Transaction":20507.0 }, "mean":{ "Transaction":4976.2023699225 }, "std":{ "Transaction":2796.203001082 }, "min":{ "Transaction":1.0 }, "25%":{ "Transaction":2552.0 }, "50%":{ "Transaction":5137.0 }, "75%":{ "Transaction":7357.0 }, "max":{ "Transaction":9684.0 } } # Randome sample of 10 rows from the dataframe. df_random_sample = { "count":{ "Transaction":20507.0 }, "mean":{ "Transaction":4976.2023699225 }, "std":{ "Transaction":2796.203001082 }, "min":{ "Transaction":1.0 }, "25%":{ "Transaction":2552.0 }, "50%":{ "Transaction":5137.0 }, "75%":{ "Transaction":7357.0 }, "max":{ "Transaction":9684.0 } } ''' The question categories are: - boolean: Valid answers include True/False, Y/N, Yes/No (all case insensitive). - category: A value from a cell (or a substring of a cell) in the dataset. - number: A numerical value from a cell in the dataset, which may represent a computed statistic (e.g., average, maximum, minimum). - list[category]: A list containing a fixed number of categories. The expected format is: "['cat', 'dog']". Pay attention to the wording of the question to determine if uniqueness is required or if repeated values are allowed. - list[number]: Similar to list[category], but with numbers as its elements. ''' # TODO: complete the following function in one line, by completing the return statement. It should give the answer to: How many rows are there in this dataframe? def example(df: pd.DataFrame): df.columns=["A"] # Expected output type: is number, this will be checked. return df.shape[0] # It should give the answer to: Is there any transaction that took place during the night? # The answer should only contain python code, you are not allowed leave any TODO undone. def answer(df: pd.DataFrame): # Use df to answer: Is there any transaction that took place during the night? df.columns = ['Transaction', 'Item', 'date_time', 'period_day', 'weekday_weekend'] # Expected output type: is boolean, this will be checked. return
20250129013723
202
Do all items have transactions recorded on weekdays?
060_Bakery
dev
boolean
[Item, weekday_weekend]
dev
# Instructions: Generate ONLY python code. Do not include explanations. # you can use pandas and numpy. Use the meta data information from df_schema, df_descprtion. import pandas as pd import numpy as np # Description of dataframe schema. df_schema = { "columns": [ { "name": "Transaction", "type": "uint16" }, { "name": "Item", "type": "category" }, { "name": "date_time", "type": "category" }, { "name": "period_day", "type": "category" }, { "name": "weekday_weekend", "type": "category" } ] } # Description of dataframe columns. df_descrption = { "count":{ "Transaction":20507.0 }, "mean":{ "Transaction":4976.2023699225 }, "std":{ "Transaction":2796.203001082 }, "min":{ "Transaction":1.0 }, "25%":{ "Transaction":2552.0 }, "50%":{ "Transaction":5137.0 }, "75%":{ "Transaction":7357.0 }, "max":{ "Transaction":9684.0 } } # Randome sample of 10 rows from the dataframe. df_random_sample = { "count":{ "Transaction":20507.0 }, "mean":{ "Transaction":4976.2023699225 }, "std":{ "Transaction":2796.203001082 }, "min":{ "Transaction":1.0 }, "25%":{ "Transaction":2552.0 }, "50%":{ "Transaction":5137.0 }, "75%":{ "Transaction":7357.0 }, "max":{ "Transaction":9684.0 } } ''' The question categories are: - boolean: Valid answers include True/False, Y/N, Yes/No (all case insensitive). - category: A value from a cell (or a substring of a cell) in the dataset. - number: A numerical value from a cell in the dataset, which may represent a computed statistic (e.g., average, maximum, minimum). - list[category]: A list containing a fixed number of categories. The expected format is: "['cat', 'dog']". Pay attention to the wording of the question to determine if uniqueness is required or if repeated values are allowed. - list[number]: Similar to list[category], but with numbers as its elements. ''' # TODO: complete the following function in one line, by completing the return statement. It should give the answer to: How many rows are there in this dataframe? def example(df: pd.DataFrame): df.columns=["A"] # Expected output type: is number, this will be checked. return df.shape[0] # It should give the answer to: Do all items have transactions recorded on weekdays? # The answer should only contain python code, you are not allowed leave any TODO undone. def answer(df: pd.DataFrame): # Use df to answer: Do all items have transactions recorded on weekdays? df.columns = ['Transaction', 'Item', 'date_time', 'period_day', 'weekday_weekend'] # Expected output type: is boolean, this will be checked. return
20250129013723
203
Are there any transactions recorded in the evening on weekends?
060_Bakery
dev
boolean
[period_day, weekday_weekend]
dev
# Instructions: Generate ONLY python code. Do not include explanations. # you can use pandas and numpy. Use the meta data information from df_schema, df_descprtion. import pandas as pd import numpy as np # Description of dataframe schema. df_schema = { "columns": [ { "name": "Transaction", "type": "uint16" }, { "name": "Item", "type": "category" }, { "name": "date_time", "type": "category" }, { "name": "period_day", "type": "category" }, { "name": "weekday_weekend", "type": "category" } ] } # Description of dataframe columns. df_descrption = { "count":{ "Transaction":20507.0 }, "mean":{ "Transaction":4976.2023699225 }, "std":{ "Transaction":2796.203001082 }, "min":{ "Transaction":1.0 }, "25%":{ "Transaction":2552.0 }, "50%":{ "Transaction":5137.0 }, "75%":{ "Transaction":7357.0 }, "max":{ "Transaction":9684.0 } } # Randome sample of 10 rows from the dataframe. df_random_sample = { "count":{ "Transaction":20507.0 }, "mean":{ "Transaction":4976.2023699225 }, "std":{ "Transaction":2796.203001082 }, "min":{ "Transaction":1.0 }, "25%":{ "Transaction":2552.0 }, "50%":{ "Transaction":5137.0 }, "75%":{ "Transaction":7357.0 }, "max":{ "Transaction":9684.0 } } ''' The question categories are: - boolean: Valid answers include True/False, Y/N, Yes/No (all case insensitive). - category: A value from a cell (or a substring of a cell) in the dataset. - number: A numerical value from a cell in the dataset, which may represent a computed statistic (e.g., average, maximum, minimum). - list[category]: A list containing a fixed number of categories. The expected format is: "['cat', 'dog']". Pay attention to the wording of the question to determine if uniqueness is required or if repeated values are allowed. - list[number]: Similar to list[category], but with numbers as its elements. ''' # TODO: complete the following function in one line, by completing the return statement. It should give the answer to: How many rows are there in this dataframe? def example(df: pd.DataFrame): df.columns=["A"] # Expected output type: is number, this will be checked. return df.shape[0] # It should give the answer to: Are there any transactions recorded in the evening on weekends? # The answer should only contain python code, you are not allowed leave any TODO undone. def answer(df: pd.DataFrame): # Use df to answer: Are there any transactions recorded in the evening on weekends? df.columns = ['Transaction', 'Item', 'date_time', 'period_day', 'weekday_weekend'] # Expected output type: is boolean, this will be checked. return
20250129013723
204
How many unique items are there in the dataset?
060_Bakery
dev
number
[Item]
dev
# Instructions: Generate ONLY python code. Do not include explanations. # you can use pandas and numpy. Use the meta data information from df_schema, df_descprtion. import pandas as pd import numpy as np # Description of dataframe schema. df_schema = { "columns": [ { "name": "Transaction", "type": "uint16" }, { "name": "Item", "type": "category" }, { "name": "date_time", "type": "category" }, { "name": "period_day", "type": "category" }, { "name": "weekday_weekend", "type": "category" } ] } # Description of dataframe columns. df_descrption = { "count":{ "Transaction":20507.0 }, "mean":{ "Transaction":4976.2023699225 }, "std":{ "Transaction":2796.203001082 }, "min":{ "Transaction":1.0 }, "25%":{ "Transaction":2552.0 }, "50%":{ "Transaction":5137.0 }, "75%":{ "Transaction":7357.0 }, "max":{ "Transaction":9684.0 } } # Randome sample of 10 rows from the dataframe. df_random_sample = { "count":{ "Transaction":20507.0 }, "mean":{ "Transaction":4976.2023699225 }, "std":{ "Transaction":2796.203001082 }, "min":{ "Transaction":1.0 }, "25%":{ "Transaction":2552.0 }, "50%":{ "Transaction":5137.0 }, "75%":{ "Transaction":7357.0 }, "max":{ "Transaction":9684.0 } } ''' The question categories are: - boolean: Valid answers include True/False, Y/N, Yes/No (all case insensitive). - category: A value from a cell (or a substring of a cell) in the dataset. - number: A numerical value from a cell in the dataset, which may represent a computed statistic (e.g., average, maximum, minimum). - list[category]: A list containing a fixed number of categories. The expected format is: "['cat', 'dog']". Pay attention to the wording of the question to determine if uniqueness is required or if repeated values are allowed. - list[number]: Similar to list[category], but with numbers as its elements. ''' # TODO: complete the following function in one line, by completing the return statement. It should give the answer to: How many rows are there in this dataframe? def example(df: pd.DataFrame): df.columns=["A"] # Expected output type: is number, this will be checked. return df.shape[0] # It should give the answer to: How many unique items are there in the dataset? # The answer should only contain python code, you are not allowed leave any TODO undone. def answer(df: pd.DataFrame): # Use df to answer: How many unique items are there in the dataset? df.columns = ['Transaction', 'Item', 'date_time', 'period_day', 'weekday_weekend'] # Expected output type: is number, this will be checked. return
20250129013723
205
On how many different days were transactions recorded?
060_Bakery
dev
number
[date_time]
dev
# Instructions: Generate ONLY python code. Do not include explanations. # you can use pandas and numpy. Use the meta data information from df_schema, df_descprtion. import pandas as pd import numpy as np # Description of dataframe schema. df_schema = { "columns": [ { "name": "Transaction", "type": "uint16" }, { "name": "Item", "type": "category" }, { "name": "date_time", "type": "category" }, { "name": "period_day", "type": "category" }, { "name": "weekday_weekend", "type": "category" } ] } # Description of dataframe columns. df_descrption = { "count":{ "Transaction":20507.0 }, "mean":{ "Transaction":4976.2023699225 }, "std":{ "Transaction":2796.203001082 }, "min":{ "Transaction":1.0 }, "25%":{ "Transaction":2552.0 }, "50%":{ "Transaction":5137.0 }, "75%":{ "Transaction":7357.0 }, "max":{ "Transaction":9684.0 } } # Randome sample of 10 rows from the dataframe. df_random_sample = { "count":{ "Transaction":20507.0 }, "mean":{ "Transaction":4976.2023699225 }, "std":{ "Transaction":2796.203001082 }, "min":{ "Transaction":1.0 }, "25%":{ "Transaction":2552.0 }, "50%":{ "Transaction":5137.0 }, "75%":{ "Transaction":7357.0 }, "max":{ "Transaction":9684.0 } } ''' The question categories are: - boolean: Valid answers include True/False, Y/N, Yes/No (all case insensitive). - category: A value from a cell (or a substring of a cell) in the dataset. - number: A numerical value from a cell in the dataset, which may represent a computed statistic (e.g., average, maximum, minimum). - list[category]: A list containing a fixed number of categories. The expected format is: "['cat', 'dog']". Pay attention to the wording of the question to determine if uniqueness is required or if repeated values are allowed. - list[number]: Similar to list[category], but with numbers as its elements. ''' # TODO: complete the following function in one line, by completing the return statement. It should give the answer to: How many rows are there in this dataframe? def example(df: pd.DataFrame): df.columns=["A"] # Expected output type: is number, this will be checked. return df.shape[0] # It should give the answer to: On how many different days were transactions recorded? # The answer should only contain python code, you are not allowed leave any TODO undone. def answer(df: pd.DataFrame): # Use df to answer: On how many different days were transactions recorded? df.columns = ['Transaction', 'Item', 'date_time', 'period_day', 'weekday_weekend'] # Expected output type: is number, this will be checked. return
20250129013723
206
What's the highest transaction number?
060_Bakery
dev
number
[Transaction]
dev
# Instructions: Generate ONLY python code. Do not include explanations. # you can use pandas and numpy. Use the meta data information from df_schema, df_descprtion. import pandas as pd import numpy as np # Description of dataframe schema. df_schema = { "columns": [ { "name": "Transaction", "type": "uint16" }, { "name": "Item", "type": "category" }, { "name": "date_time", "type": "category" }, { "name": "period_day", "type": "category" }, { "name": "weekday_weekend", "type": "category" } ] } # Description of dataframe columns. df_descrption = { "count":{ "Transaction":20507.0 }, "mean":{ "Transaction":4976.2023699225 }, "std":{ "Transaction":2796.203001082 }, "min":{ "Transaction":1.0 }, "25%":{ "Transaction":2552.0 }, "50%":{ "Transaction":5137.0 }, "75%":{ "Transaction":7357.0 }, "max":{ "Transaction":9684.0 } } # Randome sample of 10 rows from the dataframe. df_random_sample = { "count":{ "Transaction":20507.0 }, "mean":{ "Transaction":4976.2023699225 }, "std":{ "Transaction":2796.203001082 }, "min":{ "Transaction":1.0 }, "25%":{ "Transaction":2552.0 }, "50%":{ "Transaction":5137.0 }, "75%":{ "Transaction":7357.0 }, "max":{ "Transaction":9684.0 } } ''' The question categories are: - boolean: Valid answers include True/False, Y/N, Yes/No (all case insensitive). - category: A value from a cell (or a substring of a cell) in the dataset. - number: A numerical value from a cell in the dataset, which may represent a computed statistic (e.g., average, maximum, minimum). - list[category]: A list containing a fixed number of categories. The expected format is: "['cat', 'dog']". Pay attention to the wording of the question to determine if uniqueness is required or if repeated values are allowed. - list[number]: Similar to list[category], but with numbers as its elements. ''' # TODO: complete the following function in one line, by completing the return statement. It should give the answer to: How many rows are there in this dataframe? def example(df: pd.DataFrame): df.columns=["A"] # Expected output type: is number, this will be checked. return df.shape[0] # It should give the answer to: What's the highest transaction number? # The answer should only contain python code, you are not allowed leave any TODO undone. def answer(df: pd.DataFrame): # Use df to answer: What's the highest transaction number? df.columns = ['Transaction', 'Item', 'date_time', 'period_day', 'weekday_weekend'] # Expected output type: is number, this will be checked. return
20250129013723
207
How many different IDs are there in the transactions that were made during the afternoon?
060_Bakery
dev
number
[Transaction, period_day]
dev
# Instructions: Generate ONLY python code. Do not include explanations. # you can use pandas and numpy. Use the meta data information from df_schema, df_descprtion. import pandas as pd import numpy as np # Description of dataframe schema. df_schema = { "columns": [ { "name": "Transaction", "type": "uint16" }, { "name": "Item", "type": "category" }, { "name": "date_time", "type": "category" }, { "name": "period_day", "type": "category" }, { "name": "weekday_weekend", "type": "category" } ] } # Description of dataframe columns. df_descrption = { "count":{ "Transaction":20507.0 }, "mean":{ "Transaction":4976.2023699225 }, "std":{ "Transaction":2796.203001082 }, "min":{ "Transaction":1.0 }, "25%":{ "Transaction":2552.0 }, "50%":{ "Transaction":5137.0 }, "75%":{ "Transaction":7357.0 }, "max":{ "Transaction":9684.0 } } # Randome sample of 10 rows from the dataframe. df_random_sample = { "count":{ "Transaction":20507.0 }, "mean":{ "Transaction":4976.2023699225 }, "std":{ "Transaction":2796.203001082 }, "min":{ "Transaction":1.0 }, "25%":{ "Transaction":2552.0 }, "50%":{ "Transaction":5137.0 }, "75%":{ "Transaction":7357.0 }, "max":{ "Transaction":9684.0 } } ''' The question categories are: - boolean: Valid answers include True/False, Y/N, Yes/No (all case insensitive). - category: A value from a cell (or a substring of a cell) in the dataset. - number: A numerical value from a cell in the dataset, which may represent a computed statistic (e.g., average, maximum, minimum). - list[category]: A list containing a fixed number of categories. The expected format is: "['cat', 'dog']". Pay attention to the wording of the question to determine if uniqueness is required or if repeated values are allowed. - list[number]: Similar to list[category], but with numbers as its elements. ''' # TODO: complete the following function in one line, by completing the return statement. It should give the answer to: How many rows are there in this dataframe? def example(df: pd.DataFrame): df.columns=["A"] # Expected output type: is number, this will be checked. return df.shape[0] # It should give the answer to: How many different IDs are there in the transactions that were made during the afternoon? # The answer should only contain python code, you are not allowed leave any TODO undone. def answer(df: pd.DataFrame): # Use df to answer: How many different IDs are there in the transactions that were made during the afternoon? df.columns = ['Transaction', 'Item', 'date_time', 'period_day', 'weekday_weekend'] # Expected output type: is number, this will be checked. return
20250129013723
208
Which day period has the highest number of unique transaction IDs?
060_Bakery
dev
category
[period_day, Transaction]
dev
# Instructions: Generate ONLY python code. Do not include explanations. # you can use pandas and numpy. Use the meta data information from df_schema, df_descprtion. import pandas as pd import numpy as np # Description of dataframe schema. df_schema = { "columns": [ { "name": "Transaction", "type": "uint16" }, { "name": "Item", "type": "category" }, { "name": "date_time", "type": "category" }, { "name": "period_day", "type": "category" }, { "name": "weekday_weekend", "type": "category" } ] } # Description of dataframe columns. df_descrption = { "count":{ "Transaction":20507.0 }, "mean":{ "Transaction":4976.2023699225 }, "std":{ "Transaction":2796.203001082 }, "min":{ "Transaction":1.0 }, "25%":{ "Transaction":2552.0 }, "50%":{ "Transaction":5137.0 }, "75%":{ "Transaction":7357.0 }, "max":{ "Transaction":9684.0 } } # Randome sample of 10 rows from the dataframe. df_random_sample = { "count":{ "Transaction":20507.0 }, "mean":{ "Transaction":4976.2023699225 }, "std":{ "Transaction":2796.203001082 }, "min":{ "Transaction":1.0 }, "25%":{ "Transaction":2552.0 }, "50%":{ "Transaction":5137.0 }, "75%":{ "Transaction":7357.0 }, "max":{ "Transaction":9684.0 } } ''' The question categories are: - boolean: Valid answers include True/False, Y/N, Yes/No (all case insensitive). - category: A value from a cell (or a substring of a cell) in the dataset. - number: A numerical value from a cell in the dataset, which may represent a computed statistic (e.g., average, maximum, minimum). - list[category]: A list containing a fixed number of categories. The expected format is: "['cat', 'dog']". Pay attention to the wording of the question to determine if uniqueness is required or if repeated values are allowed. - list[number]: Similar to list[category], but with numbers as its elements. ''' # TODO: complete the following function in one line, by completing the return statement. It should give the answer to: How many rows are there in this dataframe? def example(df: pd.DataFrame): df.columns=["A"] # Expected output type: is number, this will be checked. return df.shape[0] # It should give the answer to: Which day period has the highest number of unique transaction IDs? # The answer should only contain python code, you are not allowed leave any TODO undone. def answer(df: pd.DataFrame): # Use df to answer: Which day period has the highest number of unique transaction IDs? df.columns = ['Transaction', 'Item', 'date_time', 'period_day', 'weekday_weekend'] # Expected output type: is category, this will be checked. return
20250129013723
209
On weekdays, what's the most commonly bought item?
060_Bakery
dev
category
[Item, weekday_weekend]
dev
# Instructions: Generate ONLY python code. Do not include explanations. # you can use pandas and numpy. Use the meta data information from df_schema, df_descprtion. import pandas as pd import numpy as np # Description of dataframe schema. df_schema = { "columns": [ { "name": "Transaction", "type": "uint16" }, { "name": "Item", "type": "category" }, { "name": "date_time", "type": "category" }, { "name": "period_day", "type": "category" }, { "name": "weekday_weekend", "type": "category" } ] } # Description of dataframe columns. df_descrption = { "count":{ "Transaction":20507.0 }, "mean":{ "Transaction":4976.2023699225 }, "std":{ "Transaction":2796.203001082 }, "min":{ "Transaction":1.0 }, "25%":{ "Transaction":2552.0 }, "50%":{ "Transaction":5137.0 }, "75%":{ "Transaction":7357.0 }, "max":{ "Transaction":9684.0 } } # Randome sample of 10 rows from the dataframe. df_random_sample = { "count":{ "Transaction":20507.0 }, "mean":{ "Transaction":4976.2023699225 }, "std":{ "Transaction":2796.203001082 }, "min":{ "Transaction":1.0 }, "25%":{ "Transaction":2552.0 }, "50%":{ "Transaction":5137.0 }, "75%":{ "Transaction":7357.0 }, "max":{ "Transaction":9684.0 } } ''' The question categories are: - boolean: Valid answers include True/False, Y/N, Yes/No (all case insensitive). - category: A value from a cell (or a substring of a cell) in the dataset. - number: A numerical value from a cell in the dataset, which may represent a computed statistic (e.g., average, maximum, minimum). - list[category]: A list containing a fixed number of categories. The expected format is: "['cat', 'dog']". Pay attention to the wording of the question to determine if uniqueness is required or if repeated values are allowed. - list[number]: Similar to list[category], but with numbers as its elements. ''' # TODO: complete the following function in one line, by completing the return statement. It should give the answer to: How many rows are there in this dataframe? def example(df: pd.DataFrame): df.columns=["A"] # Expected output type: is number, this will be checked. return df.shape[0] # It should give the answer to: On weekdays, what's the most commonly bought item? # The answer should only contain python code, you are not allowed leave any TODO undone. def answer(df: pd.DataFrame): # Use df to answer: On weekdays, what's the most commonly bought item? df.columns = ['Transaction', 'Item', 'date_time', 'period_day', 'weekday_weekend'] # Expected output type: is category, this will be checked. return
20250129013723
210
What's the least popular item bought during weekdays?
060_Bakery
dev
category
[Item, weekday_weekend]
dev
# Instructions: Generate ONLY python code. Do not include explanations. # you can use pandas and numpy. Use the meta data information from df_schema, df_descprtion. import pandas as pd import numpy as np # Description of dataframe schema. df_schema = { "columns": [ { "name": "Transaction", "type": "uint16" }, { "name": "Item", "type": "category" }, { "name": "date_time", "type": "category" }, { "name": "period_day", "type": "category" }, { "name": "weekday_weekend", "type": "category" } ] } # Description of dataframe columns. df_descrption = { "count":{ "Transaction":20507.0 }, "mean":{ "Transaction":4976.2023699225 }, "std":{ "Transaction":2796.203001082 }, "min":{ "Transaction":1.0 }, "25%":{ "Transaction":2552.0 }, "50%":{ "Transaction":5137.0 }, "75%":{ "Transaction":7357.0 }, "max":{ "Transaction":9684.0 } } # Randome sample of 10 rows from the dataframe. df_random_sample = { "count":{ "Transaction":20507.0 }, "mean":{ "Transaction":4976.2023699225 }, "std":{ "Transaction":2796.203001082 }, "min":{ "Transaction":1.0 }, "25%":{ "Transaction":2552.0 }, "50%":{ "Transaction":5137.0 }, "75%":{ "Transaction":7357.0 }, "max":{ "Transaction":9684.0 } } ''' The question categories are: - boolean: Valid answers include True/False, Y/N, Yes/No (all case insensitive). - category: A value from a cell (or a substring of a cell) in the dataset. - number: A numerical value from a cell in the dataset, which may represent a computed statistic (e.g., average, maximum, minimum). - list[category]: A list containing a fixed number of categories. The expected format is: "['cat', 'dog']". Pay attention to the wording of the question to determine if uniqueness is required or if repeated values are allowed. - list[number]: Similar to list[category], but with numbers as its elements. ''' # TODO: complete the following function in one line, by completing the return statement. It should give the answer to: How many rows are there in this dataframe? def example(df: pd.DataFrame): df.columns=["A"] # Expected output type: is number, this will be checked. return df.shape[0] # It should give the answer to: What's the least popular item bought during weekdays? # The answer should only contain python code, you are not allowed leave any TODO undone. def answer(df: pd.DataFrame): # Use df to answer: What's the least popular item bought during weekdays? df.columns = ['Transaction', 'Item', 'date_time', 'period_day', 'weekday_weekend'] # Expected output type: is category, this will be checked. return
20250129013723
211
During which period of the day is Brownie" most frequently bought?"
060_Bakery
dev
category
[Item, period_day]
dev
# Instructions: Generate ONLY python code. Do not include explanations. # you can use pandas and numpy. Use the meta data information from df_schema, df_descprtion. import pandas as pd import numpy as np # Description of dataframe schema. df_schema = { "columns": [ { "name": "Transaction", "type": "uint16" }, { "name": "Item", "type": "category" }, { "name": "date_time", "type": "category" }, { "name": "period_day", "type": "category" }, { "name": "weekday_weekend", "type": "category" } ] } # Description of dataframe columns. df_descrption = { "count":{ "Transaction":20507.0 }, "mean":{ "Transaction":4976.2023699225 }, "std":{ "Transaction":2796.203001082 }, "min":{ "Transaction":1.0 }, "25%":{ "Transaction":2552.0 }, "50%":{ "Transaction":5137.0 }, "75%":{ "Transaction":7357.0 }, "max":{ "Transaction":9684.0 } } # Randome sample of 10 rows from the dataframe. df_random_sample = { "count":{ "Transaction":20507.0 }, "mean":{ "Transaction":4976.2023699225 }, "std":{ "Transaction":2796.203001082 }, "min":{ "Transaction":1.0 }, "25%":{ "Transaction":2552.0 }, "50%":{ "Transaction":5137.0 }, "75%":{ "Transaction":7357.0 }, "max":{ "Transaction":9684.0 } } ''' The question categories are: - boolean: Valid answers include True/False, Y/N, Yes/No (all case insensitive). - category: A value from a cell (or a substring of a cell) in the dataset. - number: A numerical value from a cell in the dataset, which may represent a computed statistic (e.g., average, maximum, minimum). - list[category]: A list containing a fixed number of categories. The expected format is: "['cat', 'dog']". Pay attention to the wording of the question to determine if uniqueness is required or if repeated values are allowed. - list[number]: Similar to list[category], but with numbers as its elements. ''' # TODO: complete the following function in one line, by completing the return statement. It should give the answer to: How many rows are there in this dataframe? def example(df: pd.DataFrame): df.columns=["A"] # Expected output type: is number, this will be checked. return df.shape[0] # It should give the answer to: During which period of the day is Brownie" most frequently bought?" # The answer should only contain python code, you are not allowed leave any TODO undone. def answer(df: pd.DataFrame): # Use df to answer: During which period of the day is Brownie" most frequently bought?" df.columns = ['Transaction', 'Item', 'date_time', 'period_day', 'weekday_weekend'] # Expected output type: is category, this will be checked. return
20250129013723
212
List the top 3 items most frequently bought in the morning.
060_Bakery
dev
list[category]
[Item, period_day]
dev
# Instructions: Generate ONLY python code. Do not include explanations. # you can use pandas and numpy. Use the meta data information from df_schema, df_descprtion. import pandas as pd import numpy as np # Description of dataframe schema. df_schema = { "columns": [ { "name": "Transaction", "type": "uint16" }, { "name": "Item", "type": "category" }, { "name": "date_time", "type": "category" }, { "name": "period_day", "type": "category" }, { "name": "weekday_weekend", "type": "category" } ] } # Description of dataframe columns. df_descrption = { "count":{ "Transaction":20507.0 }, "mean":{ "Transaction":4976.2023699225 }, "std":{ "Transaction":2796.203001082 }, "min":{ "Transaction":1.0 }, "25%":{ "Transaction":2552.0 }, "50%":{ "Transaction":5137.0 }, "75%":{ "Transaction":7357.0 }, "max":{ "Transaction":9684.0 } } # Randome sample of 10 rows from the dataframe. df_random_sample = { "count":{ "Transaction":20507.0 }, "mean":{ "Transaction":4976.2023699225 }, "std":{ "Transaction":2796.203001082 }, "min":{ "Transaction":1.0 }, "25%":{ "Transaction":2552.0 }, "50%":{ "Transaction":5137.0 }, "75%":{ "Transaction":7357.0 }, "max":{ "Transaction":9684.0 } } ''' The question categories are: - boolean: Valid answers include True/False, Y/N, Yes/No (all case insensitive). - category: A value from a cell (or a substring of a cell) in the dataset. - number: A numerical value from a cell in the dataset, which may represent a computed statistic (e.g., average, maximum, minimum). - list[category]: A list containing a fixed number of categories. The expected format is: "['cat', 'dog']". Pay attention to the wording of the question to determine if uniqueness is required or if repeated values are allowed. - list[number]: Similar to list[category], but with numbers as its elements. ''' # TODO: complete the following function in one line, by completing the return statement. It should give the answer to: How many rows are there in this dataframe? def example(df: pd.DataFrame): df.columns=["A"] # Expected output type: is number, this will be checked. return df.shape[0] # It should give the answer to: List the top 3 items most frequently bought in the morning. # The answer should only contain python code, you are not allowed leave any TODO undone. def answer(df: pd.DataFrame): # Use df to answer: List the top 3 items most frequently bought in the morning. df.columns = ['Transaction', 'Item', 'date_time', 'period_day', 'weekday_weekend'] # Expected output type: is list[category], this will be checked. return
20250129013723
213
Name the top 2 most purchased during the afternoon.
060_Bakery
dev
list[category]
[Item, period_day]
dev
# Instructions: Generate ONLY python code. Do not include explanations. # you can use pandas and numpy. Use the meta data information from df_schema, df_descprtion. import pandas as pd import numpy as np # Description of dataframe schema. df_schema = { "columns": [ { "name": "Transaction", "type": "uint16" }, { "name": "Item", "type": "category" }, { "name": "date_time", "type": "category" }, { "name": "period_day", "type": "category" }, { "name": "weekday_weekend", "type": "category" } ] } # Description of dataframe columns. df_descrption = { "count":{ "Transaction":20507.0 }, "mean":{ "Transaction":4976.2023699225 }, "std":{ "Transaction":2796.203001082 }, "min":{ "Transaction":1.0 }, "25%":{ "Transaction":2552.0 }, "50%":{ "Transaction":5137.0 }, "75%":{ "Transaction":7357.0 }, "max":{ "Transaction":9684.0 } } # Randome sample of 10 rows from the dataframe. df_random_sample = { "count":{ "Transaction":20507.0 }, "mean":{ "Transaction":4976.2023699225 }, "std":{ "Transaction":2796.203001082 }, "min":{ "Transaction":1.0 }, "25%":{ "Transaction":2552.0 }, "50%":{ "Transaction":5137.0 }, "75%":{ "Transaction":7357.0 }, "max":{ "Transaction":9684.0 } } ''' The question categories are: - boolean: Valid answers include True/False, Y/N, Yes/No (all case insensitive). - category: A value from a cell (or a substring of a cell) in the dataset. - number: A numerical value from a cell in the dataset, which may represent a computed statistic (e.g., average, maximum, minimum). - list[category]: A list containing a fixed number of categories. The expected format is: "['cat', 'dog']". Pay attention to the wording of the question to determine if uniqueness is required or if repeated values are allowed. - list[number]: Similar to list[category], but with numbers as its elements. ''' # TODO: complete the following function in one line, by completing the return statement. It should give the answer to: How many rows are there in this dataframe? def example(df: pd.DataFrame): df.columns=["A"] # Expected output type: is number, this will be checked. return df.shape[0] # It should give the answer to: Name the top 2 most purchased during the afternoon. # The answer should only contain python code, you are not allowed leave any TODO undone. def answer(df: pd.DataFrame): # Use df to answer: Name the top 2 most purchased during the afternoon. df.columns = ['Transaction', 'Item', 'date_time', 'period_day', 'weekday_weekend'] # Expected output type: is list[category], this will be checked. return
20250129013723
214
Identify the top 2 items sold on weekends. If a tie then sort alphabetical.
060_Bakery
dev
list[category]
[Item, weekday_weekend]
dev
# Instructions: Generate ONLY python code. Do not include explanations. # you can use pandas and numpy. Use the meta data information from df_schema, df_descprtion. import pandas as pd import numpy as np # Description of dataframe schema. df_schema = { "columns": [ { "name": "Transaction", "type": "uint16" }, { "name": "Item", "type": "category" }, { "name": "date_time", "type": "category" }, { "name": "period_day", "type": "category" }, { "name": "weekday_weekend", "type": "category" } ] } # Description of dataframe columns. df_descrption = { "count":{ "Transaction":20507.0 }, "mean":{ "Transaction":4976.2023699225 }, "std":{ "Transaction":2796.203001082 }, "min":{ "Transaction":1.0 }, "25%":{ "Transaction":2552.0 }, "50%":{ "Transaction":5137.0 }, "75%":{ "Transaction":7357.0 }, "max":{ "Transaction":9684.0 } } # Randome sample of 10 rows from the dataframe. df_random_sample = { "count":{ "Transaction":20507.0 }, "mean":{ "Transaction":4976.2023699225 }, "std":{ "Transaction":2796.203001082 }, "min":{ "Transaction":1.0 }, "25%":{ "Transaction":2552.0 }, "50%":{ "Transaction":5137.0 }, "75%":{ "Transaction":7357.0 }, "max":{ "Transaction":9684.0 } } ''' The question categories are: - boolean: Valid answers include True/False, Y/N, Yes/No (all case insensitive). - category: A value from a cell (or a substring of a cell) in the dataset. - number: A numerical value from a cell in the dataset, which may represent a computed statistic (e.g., average, maximum, minimum). - list[category]: A list containing a fixed number of categories. The expected format is: "['cat', 'dog']". Pay attention to the wording of the question to determine if uniqueness is required or if repeated values are allowed. - list[number]: Similar to list[category], but with numbers as its elements. ''' # TODO: complete the following function in one line, by completing the return statement. It should give the answer to: How many rows are there in this dataframe? def example(df: pd.DataFrame): df.columns=["A"] # Expected output type: is number, this will be checked. return df.shape[0] # It should give the answer to: Identify the top 2 items sold on weekends. If a tie then sort alphabetical. # The answer should only contain python code, you are not allowed leave any TODO undone. def answer(df: pd.DataFrame): # Use df to answer: Identify the top 2 items sold on weekends. If a tie then sort alphabetical. df.columns = ['Transaction', 'Item', 'date_time', 'period_day', 'weekday_weekend'] # Expected output type: is list[category], this will be checked. return
20250129013723
215
What are the 4 items that were bought two times in the evening?
060_Bakery
dev
list[category]
[Item, period_day]
dev
# Instructions: Generate ONLY python code. Do not include explanations. # you can use pandas and numpy. Use the meta data information from df_schema, df_descprtion. import pandas as pd import numpy as np # Description of dataframe schema. df_schema = { "columns": [ { "name": "Transaction", "type": "uint16" }, { "name": "Item", "type": "category" }, { "name": "date_time", "type": "category" }, { "name": "period_day", "type": "category" }, { "name": "weekday_weekend", "type": "category" } ] } # Description of dataframe columns. df_descrption = { "count":{ "Transaction":20507.0 }, "mean":{ "Transaction":4976.2023699225 }, "std":{ "Transaction":2796.203001082 }, "min":{ "Transaction":1.0 }, "25%":{ "Transaction":2552.0 }, "50%":{ "Transaction":5137.0 }, "75%":{ "Transaction":7357.0 }, "max":{ "Transaction":9684.0 } } # Randome sample of 10 rows from the dataframe. df_random_sample = { "count":{ "Transaction":20507.0 }, "mean":{ "Transaction":4976.2023699225 }, "std":{ "Transaction":2796.203001082 }, "min":{ "Transaction":1.0 }, "25%":{ "Transaction":2552.0 }, "50%":{ "Transaction":5137.0 }, "75%":{ "Transaction":7357.0 }, "max":{ "Transaction":9684.0 } } ''' The question categories are: - boolean: Valid answers include True/False, Y/N, Yes/No (all case insensitive). - category: A value from a cell (or a substring of a cell) in the dataset. - number: A numerical value from a cell in the dataset, which may represent a computed statistic (e.g., average, maximum, minimum). - list[category]: A list containing a fixed number of categories. The expected format is: "['cat', 'dog']". Pay attention to the wording of the question to determine if uniqueness is required or if repeated values are allowed. - list[number]: Similar to list[category], but with numbers as its elements. ''' # TODO: complete the following function in one line, by completing the return statement. It should give the answer to: How many rows are there in this dataframe? def example(df: pd.DataFrame): df.columns=["A"] # Expected output type: is number, this will be checked. return df.shape[0] # It should give the answer to: What are the 4 items that were bought two times in the evening? # The answer should only contain python code, you are not allowed leave any TODO undone. def answer(df: pd.DataFrame): # Use df to answer: What are the 4 items that were bought two times in the evening? df.columns = ['Transaction', 'Item', 'date_time', 'period_day', 'weekday_weekend'] # Expected output type: is list[category], this will be checked. return
20250129013723
216
Which are the 4 transaction numbers with the most items bought?
060_Bakery
dev
list[number]
[Transaction]
dev
# Instructions: Generate ONLY python code. Do not include explanations. # you can use pandas and numpy. Use the meta data information from df_schema, df_descprtion. import pandas as pd import numpy as np # Description of dataframe schema. df_schema = { "columns": [ { "name": "Transaction", "type": "uint16" }, { "name": "Item", "type": "category" }, { "name": "date_time", "type": "category" }, { "name": "period_day", "type": "category" }, { "name": "weekday_weekend", "type": "category" } ] } # Description of dataframe columns. df_descrption = { "count":{ "Transaction":20507.0 }, "mean":{ "Transaction":4976.2023699225 }, "std":{ "Transaction":2796.203001082 }, "min":{ "Transaction":1.0 }, "25%":{ "Transaction":2552.0 }, "50%":{ "Transaction":5137.0 }, "75%":{ "Transaction":7357.0 }, "max":{ "Transaction":9684.0 } } # Randome sample of 10 rows from the dataframe. df_random_sample = { "count":{ "Transaction":20507.0 }, "mean":{ "Transaction":4976.2023699225 }, "std":{ "Transaction":2796.203001082 }, "min":{ "Transaction":1.0 }, "25%":{ "Transaction":2552.0 }, "50%":{ "Transaction":5137.0 }, "75%":{ "Transaction":7357.0 }, "max":{ "Transaction":9684.0 } } ''' The question categories are: - boolean: Valid answers include True/False, Y/N, Yes/No (all case insensitive). - category: A value from a cell (or a substring of a cell) in the dataset. - number: A numerical value from a cell in the dataset, which may represent a computed statistic (e.g., average, maximum, minimum). - list[category]: A list containing a fixed number of categories. The expected format is: "['cat', 'dog']". Pay attention to the wording of the question to determine if uniqueness is required or if repeated values are allowed. - list[number]: Similar to list[category], but with numbers as its elements. ''' # TODO: complete the following function in one line, by completing the return statement. It should give the answer to: How many rows are there in this dataframe? def example(df: pd.DataFrame): df.columns=["A"] # Expected output type: is number, this will be checked. return df.shape[0] # It should give the answer to: Which are the 4 transaction numbers with the most items bought? # The answer should only contain python code, you are not allowed leave any TODO undone. def answer(df: pd.DataFrame): # Use df to answer: Which are the 4 transaction numbers with the most items bought? df.columns = ['Transaction', 'Item', 'date_time', 'period_day', 'weekday_weekend'] # Expected output type: is list[number], this will be checked. return
20250129013723
217
Identify the highest 5 transaction numbers.
060_Bakery
dev
list[number]
[Transaction]
dev
# Instructions: Generate ONLY python code. Do not include explanations. # you can use pandas and numpy. Use the meta data information from df_schema, df_descprtion. import pandas as pd import numpy as np # Description of dataframe schema. df_schema = { "columns": [ { "name": "Transaction", "type": "uint16" }, { "name": "Item", "type": "category" }, { "name": "date_time", "type": "category" }, { "name": "period_day", "type": "category" }, { "name": "weekday_weekend", "type": "category" } ] } # Description of dataframe columns. df_descrption = { "count":{ "Transaction":20507.0 }, "mean":{ "Transaction":4976.2023699225 }, "std":{ "Transaction":2796.203001082 }, "min":{ "Transaction":1.0 }, "25%":{ "Transaction":2552.0 }, "50%":{ "Transaction":5137.0 }, "75%":{ "Transaction":7357.0 }, "max":{ "Transaction":9684.0 } } # Randome sample of 10 rows from the dataframe. df_random_sample = { "count":{ "Transaction":20507.0 }, "mean":{ "Transaction":4976.2023699225 }, "std":{ "Transaction":2796.203001082 }, "min":{ "Transaction":1.0 }, "25%":{ "Transaction":2552.0 }, "50%":{ "Transaction":5137.0 }, "75%":{ "Transaction":7357.0 }, "max":{ "Transaction":9684.0 } } ''' The question categories are: - boolean: Valid answers include True/False, Y/N, Yes/No (all case insensitive). - category: A value from a cell (or a substring of a cell) in the dataset. - number: A numerical value from a cell in the dataset, which may represent a computed statistic (e.g., average, maximum, minimum). - list[category]: A list containing a fixed number of categories. The expected format is: "['cat', 'dog']". Pay attention to the wording of the question to determine if uniqueness is required or if repeated values are allowed. - list[number]: Similar to list[category], but with numbers as its elements. ''' # TODO: complete the following function in one line, by completing the return statement. It should give the answer to: How many rows are there in this dataframe? def example(df: pd.DataFrame): df.columns=["A"] # Expected output type: is number, this will be checked. return df.shape[0] # It should give the answer to: Identify the highest 5 transaction numbers. # The answer should only contain python code, you are not allowed leave any TODO undone. def answer(df: pd.DataFrame): # Use df to answer: Identify the highest 5 transaction numbers. df.columns = ['Transaction', 'Item', 'date_time', 'period_day', 'weekday_weekend'] # Expected output type: is list[number], this will be checked. return
20250129013723
218
List the highest 4 transaction numbers during which 'Bread' was purchased.
060_Bakery
dev
list[number]
[Transaction, Item]
dev
# Instructions: Generate ONLY python code. Do not include explanations. # you can use pandas and numpy. Use the meta data information from df_schema, df_descprtion. import pandas as pd import numpy as np # Description of dataframe schema. df_schema = { "columns": [ { "name": "Transaction", "type": "uint16" }, { "name": "Item", "type": "category" }, { "name": "date_time", "type": "category" }, { "name": "period_day", "type": "category" }, { "name": "weekday_weekend", "type": "category" } ] } # Description of dataframe columns. df_descrption = { "count":{ "Transaction":20507.0 }, "mean":{ "Transaction":4976.2023699225 }, "std":{ "Transaction":2796.203001082 }, "min":{ "Transaction":1.0 }, "25%":{ "Transaction":2552.0 }, "50%":{ "Transaction":5137.0 }, "75%":{ "Transaction":7357.0 }, "max":{ "Transaction":9684.0 } } # Randome sample of 10 rows from the dataframe. df_random_sample = { "count":{ "Transaction":20507.0 }, "mean":{ "Transaction":4976.2023699225 }, "std":{ "Transaction":2796.203001082 }, "min":{ "Transaction":1.0 }, "25%":{ "Transaction":2552.0 }, "50%":{ "Transaction":5137.0 }, "75%":{ "Transaction":7357.0 }, "max":{ "Transaction":9684.0 } } ''' The question categories are: - boolean: Valid answers include True/False, Y/N, Yes/No (all case insensitive). - category: A value from a cell (or a substring of a cell) in the dataset. - number: A numerical value from a cell in the dataset, which may represent a computed statistic (e.g., average, maximum, minimum). - list[category]: A list containing a fixed number of categories. The expected format is: "['cat', 'dog']". Pay attention to the wording of the question to determine if uniqueness is required or if repeated values are allowed. - list[number]: Similar to list[category], but with numbers as its elements. ''' # TODO: complete the following function in one line, by completing the return statement. It should give the answer to: How many rows are there in this dataframe? def example(df: pd.DataFrame): df.columns=["A"] # Expected output type: is number, this will be checked. return df.shape[0] # It should give the answer to: List the highest 4 transaction numbers during which 'Bread' was purchased. # The answer should only contain python code, you are not allowed leave any TODO undone. def answer(df: pd.DataFrame): # Use df to answer: List the highest 4 transaction numbers during which 'Bread' was purchased. df.columns = ['Transaction', 'Item', 'date_time', 'period_day', 'weekday_weekend'] # Expected output type: is list[number], this will be checked. return
20250129013724
219
Name the lowest 2 transaction numbers where purchases were made in the morning.
060_Bakery
dev
list[number]
[Transaction, period_day]
dev
# Instructions: Generate ONLY python code. Do not include explanations. # you can use pandas and numpy. Use the meta data information from df_schema, df_descprtion. import pandas as pd import numpy as np # Description of dataframe schema. df_schema = { "columns": [ { "name": "Transaction", "type": "uint16" }, { "name": "Item", "type": "category" }, { "name": "date_time", "type": "category" }, { "name": "period_day", "type": "category" }, { "name": "weekday_weekend", "type": "category" } ] } # Description of dataframe columns. df_descrption = { "count":{ "Transaction":20507.0 }, "mean":{ "Transaction":4976.2023699225 }, "std":{ "Transaction":2796.203001082 }, "min":{ "Transaction":1.0 }, "25%":{ "Transaction":2552.0 }, "50%":{ "Transaction":5137.0 }, "75%":{ "Transaction":7357.0 }, "max":{ "Transaction":9684.0 } } # Randome sample of 10 rows from the dataframe. df_random_sample = { "count":{ "Transaction":20507.0 }, "mean":{ "Transaction":4976.2023699225 }, "std":{ "Transaction":2796.203001082 }, "min":{ "Transaction":1.0 }, "25%":{ "Transaction":2552.0 }, "50%":{ "Transaction":5137.0 }, "75%":{ "Transaction":7357.0 }, "max":{ "Transaction":9684.0 } } ''' The question categories are: - boolean: Valid answers include True/False, Y/N, Yes/No (all case insensitive). - category: A value from a cell (or a substring of a cell) in the dataset. - number: A numerical value from a cell in the dataset, which may represent a computed statistic (e.g., average, maximum, minimum). - list[category]: A list containing a fixed number of categories. The expected format is: "['cat', 'dog']". Pay attention to the wording of the question to determine if uniqueness is required or if repeated values are allowed. - list[number]: Similar to list[category], but with numbers as its elements. ''' # TODO: complete the following function in one line, by completing the return statement. It should give the answer to: How many rows are there in this dataframe? def example(df: pd.DataFrame): df.columns=["A"] # Expected output type: is number, this will be checked. return df.shape[0] # It should give the answer to: Name the lowest 2 transaction numbers where purchases were made in the morning. # The answer should only contain python code, you are not allowed leave any TODO undone. def answer(df: pd.DataFrame): # Use df to answer: Name the lowest 2 transaction numbers where purchases were made in the morning. df.columns = ['Transaction', 'Item', 'date_time', 'period_day', 'weekday_weekend'] # Expected output type: is list[number], this will be checked. return
20250129013724
220
Are all the reviews from Australia positive (rating > 3)?
061_Disneyland
dev
boolean
['Reviewer_Location', 'Rating']
dev
# Instructions: Generate ONLY python code. Do not include explanations. # you can use pandas and numpy. Use the meta data information from df_schema, df_descprtion. import pandas as pd import numpy as np # Description of dataframe schema. df_schema = { "columns": [ { "name": "Review_ID", "type": "uint32" }, { "name": "Rating", "type": "uint8" }, { "name": "Year_Month", "type": "category" }, { "name": "Reviewer_Location", "type": "category" }, { "name": "Review_Text", "type": "object" }, { "name": "Branch", "type": "category" } ] } # Description of dataframe columns. df_descrption = { "count":{ "Review_ID":42656.0, "Rating":42656.0 }, "mean":{ "Review_ID":318855269.8283711672, "Rating":4.2176950488 }, "std":{ "Review_ID":165709224.260283798, "Rating":1.0633710689 }, "min":{ "Review_ID":1398724.0, "Rating":1.0 }, "25%":{ "Review_ID":174327393.0, "Rating":4.0 }, "50%":{ "Review_ID":290758265.0, "Rating":5.0 }, "75%":{ "Review_ID":448957905.75, "Rating":5.0 }, "max":{ "Review_ID":670801367.0, "Rating":5.0 } } # Randome sample of 10 rows from the dataframe. df_random_sample = { "count":{ "Review_ID":42656.0, "Rating":42656.0 }, "mean":{ "Review_ID":318855269.8283711672, "Rating":4.2176950488 }, "std":{ "Review_ID":165709224.260283798, "Rating":1.0633710689 }, "min":{ "Review_ID":1398724.0, "Rating":1.0 }, "25%":{ "Review_ID":174327393.0, "Rating":4.0 }, "50%":{ "Review_ID":290758265.0, "Rating":5.0 }, "75%":{ "Review_ID":448957905.75, "Rating":5.0 }, "max":{ "Review_ID":670801367.0, "Rating":5.0 } } ''' The question categories are: - boolean: Valid answers include True/False, Y/N, Yes/No (all case insensitive). - category: A value from a cell (or a substring of a cell) in the dataset. - number: A numerical value from a cell in the dataset, which may represent a computed statistic (e.g., average, maximum, minimum). - list[category]: A list containing a fixed number of categories. The expected format is: "['cat', 'dog']". Pay attention to the wording of the question to determine if uniqueness is required or if repeated values are allowed. - list[number]: Similar to list[category], but with numbers as its elements. ''' # TODO: complete the following function in one line, by completing the return statement. It should give the answer to: How many rows are there in this dataframe? def example(df: pd.DataFrame): df.columns=["A"] # Expected output type: is number, this will be checked. return df.shape[0] # It should give the answer to: Are all the reviews from Australia positive (rating > 3)? # The answer should only contain python code, you are not allowed leave any TODO undone. def answer(df: pd.DataFrame): # Use df to answer: Are all the reviews from Australia positive (rating > 3)? df.columns = ['Review_ID', 'Rating', 'Year_Month', 'Reviewer_Location', 'Review_Text', 'Branch'] # Expected output type: is boolean, this will be checked. return
20250129013724
221
Is Disneyland_HongKong the most reviewed branch?
061_Disneyland
dev
boolean
['Branch']
dev
# Instructions: Generate ONLY python code. Do not include explanations. # you can use pandas and numpy. Use the meta data information from df_schema, df_descprtion. import pandas as pd import numpy as np # Description of dataframe schema. df_schema = { "columns": [ { "name": "Review_ID", "type": "uint32" }, { "name": "Rating", "type": "uint8" }, { "name": "Year_Month", "type": "category" }, { "name": "Reviewer_Location", "type": "category" }, { "name": "Review_Text", "type": "object" }, { "name": "Branch", "type": "category" } ] } # Description of dataframe columns. df_descrption = { "count":{ "Review_ID":42656.0, "Rating":42656.0 }, "mean":{ "Review_ID":318855269.8283711672, "Rating":4.2176950488 }, "std":{ "Review_ID":165709224.260283798, "Rating":1.0633710689 }, "min":{ "Review_ID":1398724.0, "Rating":1.0 }, "25%":{ "Review_ID":174327393.0, "Rating":4.0 }, "50%":{ "Review_ID":290758265.0, "Rating":5.0 }, "75%":{ "Review_ID":448957905.75, "Rating":5.0 }, "max":{ "Review_ID":670801367.0, "Rating":5.0 } } # Randome sample of 10 rows from the dataframe. df_random_sample = { "count":{ "Review_ID":42656.0, "Rating":42656.0 }, "mean":{ "Review_ID":318855269.8283711672, "Rating":4.2176950488 }, "std":{ "Review_ID":165709224.260283798, "Rating":1.0633710689 }, "min":{ "Review_ID":1398724.0, "Rating":1.0 }, "25%":{ "Review_ID":174327393.0, "Rating":4.0 }, "50%":{ "Review_ID":290758265.0, "Rating":5.0 }, "75%":{ "Review_ID":448957905.75, "Rating":5.0 }, "max":{ "Review_ID":670801367.0, "Rating":5.0 } } ''' The question categories are: - boolean: Valid answers include True/False, Y/N, Yes/No (all case insensitive). - category: A value from a cell (or a substring of a cell) in the dataset. - number: A numerical value from a cell in the dataset, which may represent a computed statistic (e.g., average, maximum, minimum). - list[category]: A list containing a fixed number of categories. The expected format is: "['cat', 'dog']". Pay attention to the wording of the question to determine if uniqueness is required or if repeated values are allowed. - list[number]: Similar to list[category], but with numbers as its elements. ''' # TODO: complete the following function in one line, by completing the return statement. It should give the answer to: How many rows are there in this dataframe? def example(df: pd.DataFrame): df.columns=["A"] # Expected output type: is number, this will be checked. return df.shape[0] # It should give the answer to: Is Disneyland_HongKong the most reviewed branch? # The answer should only contain python code, you are not allowed leave any TODO undone. def answer(df: pd.DataFrame): # Use df to answer: Is Disneyland_HongKong the most reviewed branch? df.columns = ['Review_ID', 'Rating', 'Year_Month', 'Reviewer_Location', 'Review_Text', 'Branch'] # Expected output type: is boolean, this will be checked. return
20250129013724
222
Are there any reviews with a rating of 1?
061_Disneyland
dev
boolean
['Rating']
dev
# Instructions: Generate ONLY python code. Do not include explanations. # you can use pandas and numpy. Use the meta data information from df_schema, df_descprtion. import pandas as pd import numpy as np # Description of dataframe schema. df_schema = { "columns": [ { "name": "Review_ID", "type": "uint32" }, { "name": "Rating", "type": "uint8" }, { "name": "Year_Month", "type": "category" }, { "name": "Reviewer_Location", "type": "category" }, { "name": "Review_Text", "type": "object" }, { "name": "Branch", "type": "category" } ] } # Description of dataframe columns. df_descrption = { "count":{ "Review_ID":42656.0, "Rating":42656.0 }, "mean":{ "Review_ID":318855269.8283711672, "Rating":4.2176950488 }, "std":{ "Review_ID":165709224.260283798, "Rating":1.0633710689 }, "min":{ "Review_ID":1398724.0, "Rating":1.0 }, "25%":{ "Review_ID":174327393.0, "Rating":4.0 }, "50%":{ "Review_ID":290758265.0, "Rating":5.0 }, "75%":{ "Review_ID":448957905.75, "Rating":5.0 }, "max":{ "Review_ID":670801367.0, "Rating":5.0 } } # Randome sample of 10 rows from the dataframe. df_random_sample = { "count":{ "Review_ID":42656.0, "Rating":42656.0 }, "mean":{ "Review_ID":318855269.8283711672, "Rating":4.2176950488 }, "std":{ "Review_ID":165709224.260283798, "Rating":1.0633710689 }, "min":{ "Review_ID":1398724.0, "Rating":1.0 }, "25%":{ "Review_ID":174327393.0, "Rating":4.0 }, "50%":{ "Review_ID":290758265.0, "Rating":5.0 }, "75%":{ "Review_ID":448957905.75, "Rating":5.0 }, "max":{ "Review_ID":670801367.0, "Rating":5.0 } } ''' The question categories are: - boolean: Valid answers include True/False, Y/N, Yes/No (all case insensitive). - category: A value from a cell (or a substring of a cell) in the dataset. - number: A numerical value from a cell in the dataset, which may represent a computed statistic (e.g., average, maximum, minimum). - list[category]: A list containing a fixed number of categories. The expected format is: "['cat', 'dog']". Pay attention to the wording of the question to determine if uniqueness is required or if repeated values are allowed. - list[number]: Similar to list[category], but with numbers as its elements. ''' # TODO: complete the following function in one line, by completing the return statement. It should give the answer to: How many rows are there in this dataframe? def example(df: pd.DataFrame): df.columns=["A"] # Expected output type: is number, this will be checked. return df.shape[0] # It should give the answer to: Are there any reviews with a rating of 1? # The answer should only contain python code, you are not allowed leave any TODO undone. def answer(df: pd.DataFrame): # Use df to answer: Are there any reviews with a rating of 1? df.columns = ['Review_ID', 'Rating', 'Year_Month', 'Reviewer_Location', 'Review_Text', 'Branch'] # Expected output type: is boolean, this will be checked. return
20250129013724
223
Does every reviewer location have at least one review with a rating of 5?
061_Disneyland
dev
boolean
['Reviewer_Location', 'Rating']
dev
# Instructions: Generate ONLY python code. Do not include explanations. # you can use pandas and numpy. Use the meta data information from df_schema, df_descprtion. import pandas as pd import numpy as np # Description of dataframe schema. df_schema = { "columns": [ { "name": "Review_ID", "type": "uint32" }, { "name": "Rating", "type": "uint8" }, { "name": "Year_Month", "type": "category" }, { "name": "Reviewer_Location", "type": "category" }, { "name": "Review_Text", "type": "object" }, { "name": "Branch", "type": "category" } ] } # Description of dataframe columns. df_descrption = { "count":{ "Review_ID":42656.0, "Rating":42656.0 }, "mean":{ "Review_ID":318855269.8283711672, "Rating":4.2176950488 }, "std":{ "Review_ID":165709224.260283798, "Rating":1.0633710689 }, "min":{ "Review_ID":1398724.0, "Rating":1.0 }, "25%":{ "Review_ID":174327393.0, "Rating":4.0 }, "50%":{ "Review_ID":290758265.0, "Rating":5.0 }, "75%":{ "Review_ID":448957905.75, "Rating":5.0 }, "max":{ "Review_ID":670801367.0, "Rating":5.0 } } # Randome sample of 10 rows from the dataframe. df_random_sample = { "count":{ "Review_ID":42656.0, "Rating":42656.0 }, "mean":{ "Review_ID":318855269.8283711672, "Rating":4.2176950488 }, "std":{ "Review_ID":165709224.260283798, "Rating":1.0633710689 }, "min":{ "Review_ID":1398724.0, "Rating":1.0 }, "25%":{ "Review_ID":174327393.0, "Rating":4.0 }, "50%":{ "Review_ID":290758265.0, "Rating":5.0 }, "75%":{ "Review_ID":448957905.75, "Rating":5.0 }, "max":{ "Review_ID":670801367.0, "Rating":5.0 } } ''' The question categories are: - boolean: Valid answers include True/False, Y/N, Yes/No (all case insensitive). - category: A value from a cell (or a substring of a cell) in the dataset. - number: A numerical value from a cell in the dataset, which may represent a computed statistic (e.g., average, maximum, minimum). - list[category]: A list containing a fixed number of categories. The expected format is: "['cat', 'dog']". Pay attention to the wording of the question to determine if uniqueness is required or if repeated values are allowed. - list[number]: Similar to list[category], but with numbers as its elements. ''' # TODO: complete the following function in one line, by completing the return statement. It should give the answer to: How many rows are there in this dataframe? def example(df: pd.DataFrame): df.columns=["A"] # Expected output type: is number, this will be checked. return df.shape[0] # It should give the answer to: Does every reviewer location have at least one review with a rating of 5? # The answer should only contain python code, you are not allowed leave any TODO undone. def answer(df: pd.DataFrame): # Use df to answer: Does every reviewer location have at least one review with a rating of 5? df.columns = ['Review_ID', 'Rating', 'Year_Month', 'Reviewer_Location', 'Review_Text', 'Branch'] # Expected output type: is boolean, this will be checked. return
20250129013724
224
How many unique reviewer locations are there?
061_Disneyland
dev
number
['Reviewer_Location']
dev
# Instructions: Generate ONLY python code. Do not include explanations. # you can use pandas and numpy. Use the meta data information from df_schema, df_descprtion. import pandas as pd import numpy as np # Description of dataframe schema. df_schema = { "columns": [ { "name": "Review_ID", "type": "uint32" }, { "name": "Rating", "type": "uint8" }, { "name": "Year_Month", "type": "category" }, { "name": "Reviewer_Location", "type": "category" }, { "name": "Review_Text", "type": "object" }, { "name": "Branch", "type": "category" } ] } # Description of dataframe columns. df_descrption = { "count":{ "Review_ID":42656.0, "Rating":42656.0 }, "mean":{ "Review_ID":318855269.8283711672, "Rating":4.2176950488 }, "std":{ "Review_ID":165709224.260283798, "Rating":1.0633710689 }, "min":{ "Review_ID":1398724.0, "Rating":1.0 }, "25%":{ "Review_ID":174327393.0, "Rating":4.0 }, "50%":{ "Review_ID":290758265.0, "Rating":5.0 }, "75%":{ "Review_ID":448957905.75, "Rating":5.0 }, "max":{ "Review_ID":670801367.0, "Rating":5.0 } } # Randome sample of 10 rows from the dataframe. df_random_sample = { "count":{ "Review_ID":42656.0, "Rating":42656.0 }, "mean":{ "Review_ID":318855269.8283711672, "Rating":4.2176950488 }, "std":{ "Review_ID":165709224.260283798, "Rating":1.0633710689 }, "min":{ "Review_ID":1398724.0, "Rating":1.0 }, "25%":{ "Review_ID":174327393.0, "Rating":4.0 }, "50%":{ "Review_ID":290758265.0, "Rating":5.0 }, "75%":{ "Review_ID":448957905.75, "Rating":5.0 }, "max":{ "Review_ID":670801367.0, "Rating":5.0 } } ''' The question categories are: - boolean: Valid answers include True/False, Y/N, Yes/No (all case insensitive). - category: A value from a cell (or a substring of a cell) in the dataset. - number: A numerical value from a cell in the dataset, which may represent a computed statistic (e.g., average, maximum, minimum). - list[category]: A list containing a fixed number of categories. The expected format is: "['cat', 'dog']". Pay attention to the wording of the question to determine if uniqueness is required or if repeated values are allowed. - list[number]: Similar to list[category], but with numbers as its elements. ''' # TODO: complete the following function in one line, by completing the return statement. It should give the answer to: How many rows are there in this dataframe? def example(df: pd.DataFrame): df.columns=["A"] # Expected output type: is number, this will be checked. return df.shape[0] # It should give the answer to: How many unique reviewer locations are there? # The answer should only contain python code, you are not allowed leave any TODO undone. def answer(df: pd.DataFrame): # Use df to answer: How many unique reviewer locations are there? df.columns = ['Review_ID', 'Rating', 'Year_Month', 'Reviewer_Location', 'Review_Text', 'Branch'] # Expected output type: is number, this will be checked. return
20250129013724
225
What is the average rating for Disneyland_HongKong?
061_Disneyland
dev
number
['Branch', 'Rating']
dev
# Instructions: Generate ONLY python code. Do not include explanations. # you can use pandas and numpy. Use the meta data information from df_schema, df_descprtion. import pandas as pd import numpy as np # Description of dataframe schema. df_schema = { "columns": [ { "name": "Review_ID", "type": "uint32" }, { "name": "Rating", "type": "uint8" }, { "name": "Year_Month", "type": "category" }, { "name": "Reviewer_Location", "type": "category" }, { "name": "Review_Text", "type": "object" }, { "name": "Branch", "type": "category" } ] } # Description of dataframe columns. df_descrption = { "count":{ "Review_ID":42656.0, "Rating":42656.0 }, "mean":{ "Review_ID":318855269.8283711672, "Rating":4.2176950488 }, "std":{ "Review_ID":165709224.260283798, "Rating":1.0633710689 }, "min":{ "Review_ID":1398724.0, "Rating":1.0 }, "25%":{ "Review_ID":174327393.0, "Rating":4.0 }, "50%":{ "Review_ID":290758265.0, "Rating":5.0 }, "75%":{ "Review_ID":448957905.75, "Rating":5.0 }, "max":{ "Review_ID":670801367.0, "Rating":5.0 } } # Randome sample of 10 rows from the dataframe. df_random_sample = { "count":{ "Review_ID":42656.0, "Rating":42656.0 }, "mean":{ "Review_ID":318855269.8283711672, "Rating":4.2176950488 }, "std":{ "Review_ID":165709224.260283798, "Rating":1.0633710689 }, "min":{ "Review_ID":1398724.0, "Rating":1.0 }, "25%":{ "Review_ID":174327393.0, "Rating":4.0 }, "50%":{ "Review_ID":290758265.0, "Rating":5.0 }, "75%":{ "Review_ID":448957905.75, "Rating":5.0 }, "max":{ "Review_ID":670801367.0, "Rating":5.0 } } ''' The question categories are: - boolean: Valid answers include True/False, Y/N, Yes/No (all case insensitive). - category: A value from a cell (or a substring of a cell) in the dataset. - number: A numerical value from a cell in the dataset, which may represent a computed statistic (e.g., average, maximum, minimum). - list[category]: A list containing a fixed number of categories. The expected format is: "['cat', 'dog']". Pay attention to the wording of the question to determine if uniqueness is required or if repeated values are allowed. - list[number]: Similar to list[category], but with numbers as its elements. ''' # TODO: complete the following function in one line, by completing the return statement. It should give the answer to: How many rows are there in this dataframe? def example(df: pd.DataFrame): df.columns=["A"] # Expected output type: is number, this will be checked. return df.shape[0] # It should give the answer to: What is the average rating for Disneyland_HongKong? # The answer should only contain python code, you are not allowed leave any TODO undone. def answer(df: pd.DataFrame): # Use df to answer: What is the average rating for Disneyland_HongKong? df.columns = ['Review_ID', 'Rating', 'Year_Month', 'Reviewer_Location', 'Review_Text', 'Branch'] # Expected output type: is number, this will be checked. return
20250129013724
226
What is the maximum review ID? If there is a tie then pick the highest ID.
061_Disneyland
dev
number
['Review_ID']
dev
# Instructions: Generate ONLY python code. Do not include explanations. # you can use pandas and numpy. Use the meta data information from df_schema, df_descprtion. import pandas as pd import numpy as np # Description of dataframe schema. df_schema = { "columns": [ { "name": "Review_ID", "type": "uint32" }, { "name": "Rating", "type": "uint8" }, { "name": "Year_Month", "type": "category" }, { "name": "Reviewer_Location", "type": "category" }, { "name": "Review_Text", "type": "object" }, { "name": "Branch", "type": "category" } ] } # Description of dataframe columns. df_descrption = { "count":{ "Review_ID":42656.0, "Rating":42656.0 }, "mean":{ "Review_ID":318855269.8283711672, "Rating":4.2176950488 }, "std":{ "Review_ID":165709224.260283798, "Rating":1.0633710689 }, "min":{ "Review_ID":1398724.0, "Rating":1.0 }, "25%":{ "Review_ID":174327393.0, "Rating":4.0 }, "50%":{ "Review_ID":290758265.0, "Rating":5.0 }, "75%":{ "Review_ID":448957905.75, "Rating":5.0 }, "max":{ "Review_ID":670801367.0, "Rating":5.0 } } # Randome sample of 10 rows from the dataframe. df_random_sample = { "count":{ "Review_ID":42656.0, "Rating":42656.0 }, "mean":{ "Review_ID":318855269.8283711672, "Rating":4.2176950488 }, "std":{ "Review_ID":165709224.260283798, "Rating":1.0633710689 }, "min":{ "Review_ID":1398724.0, "Rating":1.0 }, "25%":{ "Review_ID":174327393.0, "Rating":4.0 }, "50%":{ "Review_ID":290758265.0, "Rating":5.0 }, "75%":{ "Review_ID":448957905.75, "Rating":5.0 }, "max":{ "Review_ID":670801367.0, "Rating":5.0 } } ''' The question categories are: - boolean: Valid answers include True/False, Y/N, Yes/No (all case insensitive). - category: A value from a cell (or a substring of a cell) in the dataset. - number: A numerical value from a cell in the dataset, which may represent a computed statistic (e.g., average, maximum, minimum). - list[category]: A list containing a fixed number of categories. The expected format is: "['cat', 'dog']". Pay attention to the wording of the question to determine if uniqueness is required or if repeated values are allowed. - list[number]: Similar to list[category], but with numbers as its elements. ''' # TODO: complete the following function in one line, by completing the return statement. It should give the answer to: How many rows are there in this dataframe? def example(df: pd.DataFrame): df.columns=["A"] # Expected output type: is number, this will be checked. return df.shape[0] # It should give the answer to: What is the maximum review ID? If there is a tie then pick the highest ID. # The answer should only contain python code, you are not allowed leave any TODO undone. def answer(df: pd.DataFrame): # Use df to answer: What is the maximum review ID? If there is a tie then pick the highest ID. df.columns = ['Review_ID', 'Rating', 'Year_Month', 'Reviewer_Location', 'Review_Text', 'Branch'] # Expected output type: is number, this will be checked. return
20250129013724
227
How many reviews were made in 2019?
061_Disneyland
dev
number
['Year_Month']
dev
# Instructions: Generate ONLY python code. Do not include explanations. # you can use pandas and numpy. Use the meta data information from df_schema, df_descprtion. import pandas as pd import numpy as np # Description of dataframe schema. df_schema = { "columns": [ { "name": "Review_ID", "type": "uint32" }, { "name": "Rating", "type": "uint8" }, { "name": "Year_Month", "type": "category" }, { "name": "Reviewer_Location", "type": "category" }, { "name": "Review_Text", "type": "object" }, { "name": "Branch", "type": "category" } ] } # Description of dataframe columns. df_descrption = { "count":{ "Review_ID":42656.0, "Rating":42656.0 }, "mean":{ "Review_ID":318855269.8283711672, "Rating":4.2176950488 }, "std":{ "Review_ID":165709224.260283798, "Rating":1.0633710689 }, "min":{ "Review_ID":1398724.0, "Rating":1.0 }, "25%":{ "Review_ID":174327393.0, "Rating":4.0 }, "50%":{ "Review_ID":290758265.0, "Rating":5.0 }, "75%":{ "Review_ID":448957905.75, "Rating":5.0 }, "max":{ "Review_ID":670801367.0, "Rating":5.0 } } # Randome sample of 10 rows from the dataframe. df_random_sample = { "count":{ "Review_ID":42656.0, "Rating":42656.0 }, "mean":{ "Review_ID":318855269.8283711672, "Rating":4.2176950488 }, "std":{ "Review_ID":165709224.260283798, "Rating":1.0633710689 }, "min":{ "Review_ID":1398724.0, "Rating":1.0 }, "25%":{ "Review_ID":174327393.0, "Rating":4.0 }, "50%":{ "Review_ID":290758265.0, "Rating":5.0 }, "75%":{ "Review_ID":448957905.75, "Rating":5.0 }, "max":{ "Review_ID":670801367.0, "Rating":5.0 } } ''' The question categories are: - boolean: Valid answers include True/False, Y/N, Yes/No (all case insensitive). - category: A value from a cell (or a substring of a cell) in the dataset. - number: A numerical value from a cell in the dataset, which may represent a computed statistic (e.g., average, maximum, minimum). - list[category]: A list containing a fixed number of categories. The expected format is: "['cat', 'dog']". Pay attention to the wording of the question to determine if uniqueness is required or if repeated values are allowed. - list[number]: Similar to list[category], but with numbers as its elements. ''' # TODO: complete the following function in one line, by completing the return statement. It should give the answer to: How many rows are there in this dataframe? def example(df: pd.DataFrame): df.columns=["A"] # Expected output type: is number, this will be checked. return df.shape[0] # It should give the answer to: How many reviews were made in 2019? # The answer should only contain python code, you are not allowed leave any TODO undone. def answer(df: pd.DataFrame): # Use df to answer: How many reviews were made in 2019? df.columns = ['Review_ID', 'Rating', 'Year_Month', 'Reviewer_Location', 'Review_Text', 'Branch'] # Expected output type: is number, this will be checked. return
20250129013724
228
What is the most common reviewer location?
061_Disneyland
dev
category
['Reviewer_Location']
dev
# Instructions: Generate ONLY python code. Do not include explanations. # you can use pandas and numpy. Use the meta data information from df_schema, df_descprtion. import pandas as pd import numpy as np # Description of dataframe schema. df_schema = { "columns": [ { "name": "Review_ID", "type": "uint32" }, { "name": "Rating", "type": "uint8" }, { "name": "Year_Month", "type": "category" }, { "name": "Reviewer_Location", "type": "category" }, { "name": "Review_Text", "type": "object" }, { "name": "Branch", "type": "category" } ] } # Description of dataframe columns. df_descrption = { "count":{ "Review_ID":42656.0, "Rating":42656.0 }, "mean":{ "Review_ID":318855269.8283711672, "Rating":4.2176950488 }, "std":{ "Review_ID":165709224.260283798, "Rating":1.0633710689 }, "min":{ "Review_ID":1398724.0, "Rating":1.0 }, "25%":{ "Review_ID":174327393.0, "Rating":4.0 }, "50%":{ "Review_ID":290758265.0, "Rating":5.0 }, "75%":{ "Review_ID":448957905.75, "Rating":5.0 }, "max":{ "Review_ID":670801367.0, "Rating":5.0 } } # Randome sample of 10 rows from the dataframe. df_random_sample = { "count":{ "Review_ID":42656.0, "Rating":42656.0 }, "mean":{ "Review_ID":318855269.8283711672, "Rating":4.2176950488 }, "std":{ "Review_ID":165709224.260283798, "Rating":1.0633710689 }, "min":{ "Review_ID":1398724.0, "Rating":1.0 }, "25%":{ "Review_ID":174327393.0, "Rating":4.0 }, "50%":{ "Review_ID":290758265.0, "Rating":5.0 }, "75%":{ "Review_ID":448957905.75, "Rating":5.0 }, "max":{ "Review_ID":670801367.0, "Rating":5.0 } } ''' The question categories are: - boolean: Valid answers include True/False, Y/N, Yes/No (all case insensitive). - category: A value from a cell (or a substring of a cell) in the dataset. - number: A numerical value from a cell in the dataset, which may represent a computed statistic (e.g., average, maximum, minimum). - list[category]: A list containing a fixed number of categories. The expected format is: "['cat', 'dog']". Pay attention to the wording of the question to determine if uniqueness is required or if repeated values are allowed. - list[number]: Similar to list[category], but with numbers as its elements. ''' # TODO: complete the following function in one line, by completing the return statement. It should give the answer to: How many rows are there in this dataframe? def example(df: pd.DataFrame): df.columns=["A"] # Expected output type: is number, this will be checked. return df.shape[0] # It should give the answer to: What is the most common reviewer location? # The answer should only contain python code, you are not allowed leave any TODO undone. def answer(df: pd.DataFrame): # Use df to answer: What is the most common reviewer location? df.columns = ['Review_ID', 'Rating', 'Year_Month', 'Reviewer_Location', 'Review_Text', 'Branch'] # Expected output type: is category, this will be checked. return
20250129013724
229
What is the branch with the lowest average rating?
061_Disneyland
dev
category
['Branch', 'Rating']
dev
# Instructions: Generate ONLY python code. Do not include explanations. # you can use pandas and numpy. Use the meta data information from df_schema, df_descprtion. import pandas as pd import numpy as np # Description of dataframe schema. df_schema = { "columns": [ { "name": "Review_ID", "type": "uint32" }, { "name": "Rating", "type": "uint8" }, { "name": "Year_Month", "type": "category" }, { "name": "Reviewer_Location", "type": "category" }, { "name": "Review_Text", "type": "object" }, { "name": "Branch", "type": "category" } ] } # Description of dataframe columns. df_descrption = { "count":{ "Review_ID":42656.0, "Rating":42656.0 }, "mean":{ "Review_ID":318855269.8283711672, "Rating":4.2176950488 }, "std":{ "Review_ID":165709224.260283798, "Rating":1.0633710689 }, "min":{ "Review_ID":1398724.0, "Rating":1.0 }, "25%":{ "Review_ID":174327393.0, "Rating":4.0 }, "50%":{ "Review_ID":290758265.0, "Rating":5.0 }, "75%":{ "Review_ID":448957905.75, "Rating":5.0 }, "max":{ "Review_ID":670801367.0, "Rating":5.0 } } # Randome sample of 10 rows from the dataframe. df_random_sample = { "count":{ "Review_ID":42656.0, "Rating":42656.0 }, "mean":{ "Review_ID":318855269.8283711672, "Rating":4.2176950488 }, "std":{ "Review_ID":165709224.260283798, "Rating":1.0633710689 }, "min":{ "Review_ID":1398724.0, "Rating":1.0 }, "25%":{ "Review_ID":174327393.0, "Rating":4.0 }, "50%":{ "Review_ID":290758265.0, "Rating":5.0 }, "75%":{ "Review_ID":448957905.75, "Rating":5.0 }, "max":{ "Review_ID":670801367.0, "Rating":5.0 } } ''' The question categories are: - boolean: Valid answers include True/False, Y/N, Yes/No (all case insensitive). - category: A value from a cell (or a substring of a cell) in the dataset. - number: A numerical value from a cell in the dataset, which may represent a computed statistic (e.g., average, maximum, minimum). - list[category]: A list containing a fixed number of categories. The expected format is: "['cat', 'dog']". Pay attention to the wording of the question to determine if uniqueness is required or if repeated values are allowed. - list[number]: Similar to list[category], but with numbers as its elements. ''' # TODO: complete the following function in one line, by completing the return statement. It should give the answer to: How many rows are there in this dataframe? def example(df: pd.DataFrame): df.columns=["A"] # Expected output type: is number, this will be checked. return df.shape[0] # It should give the answer to: What is the branch with the lowest average rating? # The answer should only contain python code, you are not allowed leave any TODO undone. def answer(df: pd.DataFrame): # Use df to answer: What is the branch with the lowest average rating? df.columns = ['Review_ID', 'Rating', 'Year_Month', 'Reviewer_Location', 'Review_Text', 'Branch'] # Expected output type: is category, this will be checked. return
20250129013724
230
In which date was the first most negative review (rating=1) made?
061_Disneyland
dev
category
['Year_Month', 'Rating']
dev
# Instructions: Generate ONLY python code. Do not include explanations. # you can use pandas and numpy. Use the meta data information from df_schema, df_descprtion. import pandas as pd import numpy as np # Description of dataframe schema. df_schema = { "columns": [ { "name": "Review_ID", "type": "uint32" }, { "name": "Rating", "type": "uint8" }, { "name": "Year_Month", "type": "category" }, { "name": "Reviewer_Location", "type": "category" }, { "name": "Review_Text", "type": "object" }, { "name": "Branch", "type": "category" } ] } # Description of dataframe columns. df_descrption = { "count":{ "Review_ID":42656.0, "Rating":42656.0 }, "mean":{ "Review_ID":318855269.8283711672, "Rating":4.2176950488 }, "std":{ "Review_ID":165709224.260283798, "Rating":1.0633710689 }, "min":{ "Review_ID":1398724.0, "Rating":1.0 }, "25%":{ "Review_ID":174327393.0, "Rating":4.0 }, "50%":{ "Review_ID":290758265.0, "Rating":5.0 }, "75%":{ "Review_ID":448957905.75, "Rating":5.0 }, "max":{ "Review_ID":670801367.0, "Rating":5.0 } } # Randome sample of 10 rows from the dataframe. df_random_sample = { "count":{ "Review_ID":42656.0, "Rating":42656.0 }, "mean":{ "Review_ID":318855269.8283711672, "Rating":4.2176950488 }, "std":{ "Review_ID":165709224.260283798, "Rating":1.0633710689 }, "min":{ "Review_ID":1398724.0, "Rating":1.0 }, "25%":{ "Review_ID":174327393.0, "Rating":4.0 }, "50%":{ "Review_ID":290758265.0, "Rating":5.0 }, "75%":{ "Review_ID":448957905.75, "Rating":5.0 }, "max":{ "Review_ID":670801367.0, "Rating":5.0 } } ''' The question categories are: - boolean: Valid answers include True/False, Y/N, Yes/No (all case insensitive). - category: A value from a cell (or a substring of a cell) in the dataset. - number: A numerical value from a cell in the dataset, which may represent a computed statistic (e.g., average, maximum, minimum). - list[category]: A list containing a fixed number of categories. The expected format is: "['cat', 'dog']". Pay attention to the wording of the question to determine if uniqueness is required or if repeated values are allowed. - list[number]: Similar to list[category], but with numbers as its elements. ''' # TODO: complete the following function in one line, by completing the return statement. It should give the answer to: How many rows are there in this dataframe? def example(df: pd.DataFrame): df.columns=["A"] # Expected output type: is number, this will be checked. return df.shape[0] # It should give the answer to: In which date was the first most negative review (rating=1) made? # The answer should only contain python code, you are not allowed leave any TODO undone. def answer(df: pd.DataFrame): # Use df to answer: In which date was the first most negative review (rating=1) made? df.columns = ['Review_ID', 'Rating', 'Year_Month', 'Reviewer_Location', 'Review_Text', 'Branch'] # Expected output type: is category, this will be checked. return
20250129013724
231
What is the reviewer location with the highest average rating? If there is a tie then pick the first one alphabetically
061_Disneyland
dev
category
['Reviewer_Location', 'Rating']
dev
# Instructions: Generate ONLY python code. Do not include explanations. # you can use pandas and numpy. Use the meta data information from df_schema, df_descprtion. import pandas as pd import numpy as np # Description of dataframe schema. df_schema = { "columns": [ { "name": "Review_ID", "type": "uint32" }, { "name": "Rating", "type": "uint8" }, { "name": "Year_Month", "type": "category" }, { "name": "Reviewer_Location", "type": "category" }, { "name": "Review_Text", "type": "object" }, { "name": "Branch", "type": "category" } ] } # Description of dataframe columns. df_descrption = { "count":{ "Review_ID":42656.0, "Rating":42656.0 }, "mean":{ "Review_ID":318855269.8283711672, "Rating":4.2176950488 }, "std":{ "Review_ID":165709224.260283798, "Rating":1.0633710689 }, "min":{ "Review_ID":1398724.0, "Rating":1.0 }, "25%":{ "Review_ID":174327393.0, "Rating":4.0 }, "50%":{ "Review_ID":290758265.0, "Rating":5.0 }, "75%":{ "Review_ID":448957905.75, "Rating":5.0 }, "max":{ "Review_ID":670801367.0, "Rating":5.0 } } # Randome sample of 10 rows from the dataframe. df_random_sample = { "count":{ "Review_ID":42656.0, "Rating":42656.0 }, "mean":{ "Review_ID":318855269.8283711672, "Rating":4.2176950488 }, "std":{ "Review_ID":165709224.260283798, "Rating":1.0633710689 }, "min":{ "Review_ID":1398724.0, "Rating":1.0 }, "25%":{ "Review_ID":174327393.0, "Rating":4.0 }, "50%":{ "Review_ID":290758265.0, "Rating":5.0 }, "75%":{ "Review_ID":448957905.75, "Rating":5.0 }, "max":{ "Review_ID":670801367.0, "Rating":5.0 } } ''' The question categories are: - boolean: Valid answers include True/False, Y/N, Yes/No (all case insensitive). - category: A value from a cell (or a substring of a cell) in the dataset. - number: A numerical value from a cell in the dataset, which may represent a computed statistic (e.g., average, maximum, minimum). - list[category]: A list containing a fixed number of categories. The expected format is: "['cat', 'dog']". Pay attention to the wording of the question to determine if uniqueness is required or if repeated values are allowed. - list[number]: Similar to list[category], but with numbers as its elements. ''' # TODO: complete the following function in one line, by completing the return statement. It should give the answer to: How many rows are there in this dataframe? def example(df: pd.DataFrame): df.columns=["A"] # Expected output type: is number, this will be checked. return df.shape[0] # It should give the answer to: What is the reviewer location with the highest average rating? If there is a tie then pick the first one alphabetically # The answer should only contain python code, you are not allowed leave any TODO undone. def answer(df: pd.DataFrame): # Use df to answer: What is the reviewer location with the highest average rating? If there is a tie then pick the first one alphabetically df.columns = ['Review_ID', 'Rating', 'Year_Month', 'Reviewer_Location', 'Review_Text', 'Branch'] # Expected output type: is category, this will be checked. return
20250129013724
232
What are the top 3 reviewer locations with the most reviews?
061_Disneyland
dev
list[category]
['Reviewer_Location']
dev
# Instructions: Generate ONLY python code. Do not include explanations. # you can use pandas and numpy. Use the meta data information from df_schema, df_descprtion. import pandas as pd import numpy as np # Description of dataframe schema. df_schema = { "columns": [ { "name": "Review_ID", "type": "uint32" }, { "name": "Rating", "type": "uint8" }, { "name": "Year_Month", "type": "category" }, { "name": "Reviewer_Location", "type": "category" }, { "name": "Review_Text", "type": "object" }, { "name": "Branch", "type": "category" } ] } # Description of dataframe columns. df_descrption = { "count":{ "Review_ID":42656.0, "Rating":42656.0 }, "mean":{ "Review_ID":318855269.8283711672, "Rating":4.2176950488 }, "std":{ "Review_ID":165709224.260283798, "Rating":1.0633710689 }, "min":{ "Review_ID":1398724.0, "Rating":1.0 }, "25%":{ "Review_ID":174327393.0, "Rating":4.0 }, "50%":{ "Review_ID":290758265.0, "Rating":5.0 }, "75%":{ "Review_ID":448957905.75, "Rating":5.0 }, "max":{ "Review_ID":670801367.0, "Rating":5.0 } } # Randome sample of 10 rows from the dataframe. df_random_sample = { "count":{ "Review_ID":42656.0, "Rating":42656.0 }, "mean":{ "Review_ID":318855269.8283711672, "Rating":4.2176950488 }, "std":{ "Review_ID":165709224.260283798, "Rating":1.0633710689 }, "min":{ "Review_ID":1398724.0, "Rating":1.0 }, "25%":{ "Review_ID":174327393.0, "Rating":4.0 }, "50%":{ "Review_ID":290758265.0, "Rating":5.0 }, "75%":{ "Review_ID":448957905.75, "Rating":5.0 }, "max":{ "Review_ID":670801367.0, "Rating":5.0 } } ''' The question categories are: - boolean: Valid answers include True/False, Y/N, Yes/No (all case insensitive). - category: A value from a cell (or a substring of a cell) in the dataset. - number: A numerical value from a cell in the dataset, which may represent a computed statistic (e.g., average, maximum, minimum). - list[category]: A list containing a fixed number of categories. The expected format is: "['cat', 'dog']". Pay attention to the wording of the question to determine if uniqueness is required or if repeated values are allowed. - list[number]: Similar to list[category], but with numbers as its elements. ''' # TODO: complete the following function in one line, by completing the return statement. It should give the answer to: How many rows are there in this dataframe? def example(df: pd.DataFrame): df.columns=["A"] # Expected output type: is number, this will be checked. return df.shape[0] # It should give the answer to: What are the top 3 reviewer locations with the most reviews? # The answer should only contain python code, you are not allowed leave any TODO undone. def answer(df: pd.DataFrame): # Use df to answer: What are the top 3 reviewer locations with the most reviews? df.columns = ['Review_ID', 'Rating', 'Year_Month', 'Reviewer_Location', 'Review_Text', 'Branch'] # Expected output type: is list[category], this will be checked. return
20250129013724
233
What are the bottom 2 branches in terms of average rating?
061_Disneyland
dev
list[category]
['Branch', 'Rating']
dev
# Instructions: Generate ONLY python code. Do not include explanations. # you can use pandas and numpy. Use the meta data information from df_schema, df_descprtion. import pandas as pd import numpy as np # Description of dataframe schema. df_schema = { "columns": [ { "name": "Review_ID", "type": "uint32" }, { "name": "Rating", "type": "uint8" }, { "name": "Year_Month", "type": "category" }, { "name": "Reviewer_Location", "type": "category" }, { "name": "Review_Text", "type": "object" }, { "name": "Branch", "type": "category" } ] } # Description of dataframe columns. df_descrption = { "count":{ "Review_ID":42656.0, "Rating":42656.0 }, "mean":{ "Review_ID":318855269.8283711672, "Rating":4.2176950488 }, "std":{ "Review_ID":165709224.260283798, "Rating":1.0633710689 }, "min":{ "Review_ID":1398724.0, "Rating":1.0 }, "25%":{ "Review_ID":174327393.0, "Rating":4.0 }, "50%":{ "Review_ID":290758265.0, "Rating":5.0 }, "75%":{ "Review_ID":448957905.75, "Rating":5.0 }, "max":{ "Review_ID":670801367.0, "Rating":5.0 } } # Randome sample of 10 rows from the dataframe. df_random_sample = { "count":{ "Review_ID":42656.0, "Rating":42656.0 }, "mean":{ "Review_ID":318855269.8283711672, "Rating":4.2176950488 }, "std":{ "Review_ID":165709224.260283798, "Rating":1.0633710689 }, "min":{ "Review_ID":1398724.0, "Rating":1.0 }, "25%":{ "Review_ID":174327393.0, "Rating":4.0 }, "50%":{ "Review_ID":290758265.0, "Rating":5.0 }, "75%":{ "Review_ID":448957905.75, "Rating":5.0 }, "max":{ "Review_ID":670801367.0, "Rating":5.0 } } ''' The question categories are: - boolean: Valid answers include True/False, Y/N, Yes/No (all case insensitive). - category: A value from a cell (or a substring of a cell) in the dataset. - number: A numerical value from a cell in the dataset, which may represent a computed statistic (e.g., average, maximum, minimum). - list[category]: A list containing a fixed number of categories. The expected format is: "['cat', 'dog']". Pay attention to the wording of the question to determine if uniqueness is required or if repeated values are allowed. - list[number]: Similar to list[category], but with numbers as its elements. ''' # TODO: complete the following function in one line, by completing the return statement. It should give the answer to: How many rows are there in this dataframe? def example(df: pd.DataFrame): df.columns=["A"] # Expected output type: is number, this will be checked. return df.shape[0] # It should give the answer to: What are the bottom 2 branches in terms of average rating? # The answer should only contain python code, you are not allowed leave any TODO undone. def answer(df: pd.DataFrame): # Use df to answer: What are the bottom 2 branches in terms of average rating? df.columns = ['Review_ID', 'Rating', 'Year_Month', 'Reviewer_Location', 'Review_Text', 'Branch'] # Expected output type: is list[category], this will be checked. return
20250129013724
234
What are the 4 dates with the most reviews? Include those missing.
061_Disneyland
dev
list[category]
['Year_Month']
dev
# Instructions: Generate ONLY python code. Do not include explanations. # you can use pandas and numpy. Use the meta data information from df_schema, df_descprtion. import pandas as pd import numpy as np # Description of dataframe schema. df_schema = { "columns": [ { "name": "Review_ID", "type": "uint32" }, { "name": "Rating", "type": "uint8" }, { "name": "Year_Month", "type": "category" }, { "name": "Reviewer_Location", "type": "category" }, { "name": "Review_Text", "type": "object" }, { "name": "Branch", "type": "category" } ] } # Description of dataframe columns. df_descrption = { "count":{ "Review_ID":42656.0, "Rating":42656.0 }, "mean":{ "Review_ID":318855269.8283711672, "Rating":4.2176950488 }, "std":{ "Review_ID":165709224.260283798, "Rating":1.0633710689 }, "min":{ "Review_ID":1398724.0, "Rating":1.0 }, "25%":{ "Review_ID":174327393.0, "Rating":4.0 }, "50%":{ "Review_ID":290758265.0, "Rating":5.0 }, "75%":{ "Review_ID":448957905.75, "Rating":5.0 }, "max":{ "Review_ID":670801367.0, "Rating":5.0 } } # Randome sample of 10 rows from the dataframe. df_random_sample = { "count":{ "Review_ID":42656.0, "Rating":42656.0 }, "mean":{ "Review_ID":318855269.8283711672, "Rating":4.2176950488 }, "std":{ "Review_ID":165709224.260283798, "Rating":1.0633710689 }, "min":{ "Review_ID":1398724.0, "Rating":1.0 }, "25%":{ "Review_ID":174327393.0, "Rating":4.0 }, "50%":{ "Review_ID":290758265.0, "Rating":5.0 }, "75%":{ "Review_ID":448957905.75, "Rating":5.0 }, "max":{ "Review_ID":670801367.0, "Rating":5.0 } } ''' The question categories are: - boolean: Valid answers include True/False, Y/N, Yes/No (all case insensitive). - category: A value from a cell (or a substring of a cell) in the dataset. - number: A numerical value from a cell in the dataset, which may represent a computed statistic (e.g., average, maximum, minimum). - list[category]: A list containing a fixed number of categories. The expected format is: "['cat', 'dog']". Pay attention to the wording of the question to determine if uniqueness is required or if repeated values are allowed. - list[number]: Similar to list[category], but with numbers as its elements. ''' # TODO: complete the following function in one line, by completing the return statement. It should give the answer to: How many rows are there in this dataframe? def example(df: pd.DataFrame): df.columns=["A"] # Expected output type: is number, this will be checked. return df.shape[0] # It should give the answer to: What are the 4 dates with the most reviews? Include those missing. # The answer should only contain python code, you are not allowed leave any TODO undone. def answer(df: pd.DataFrame): # Use df to answer: What are the 4 dates with the most reviews? Include those missing. df.columns = ['Review_ID', 'Rating', 'Year_Month', 'Reviewer_Location', 'Review_Text', 'Branch'] # Expected output type: is list[category], this will be checked. return
20250129013724
235
What are the bottom 3 reviewer locations in terms of average rating?
061_Disneyland
dev
list[category]
['Reviewer_Location', 'Rating']
dev
# Instructions: Generate ONLY python code. Do not include explanations. # you can use pandas and numpy. Use the meta data information from df_schema, df_descprtion. import pandas as pd import numpy as np # Description of dataframe schema. df_schema = { "columns": [ { "name": "Review_ID", "type": "uint32" }, { "name": "Rating", "type": "uint8" }, { "name": "Year_Month", "type": "category" }, { "name": "Reviewer_Location", "type": "category" }, { "name": "Review_Text", "type": "object" }, { "name": "Branch", "type": "category" } ] } # Description of dataframe columns. df_descrption = { "count":{ "Review_ID":42656.0, "Rating":42656.0 }, "mean":{ "Review_ID":318855269.8283711672, "Rating":4.2176950488 }, "std":{ "Review_ID":165709224.260283798, "Rating":1.0633710689 }, "min":{ "Review_ID":1398724.0, "Rating":1.0 }, "25%":{ "Review_ID":174327393.0, "Rating":4.0 }, "50%":{ "Review_ID":290758265.0, "Rating":5.0 }, "75%":{ "Review_ID":448957905.75, "Rating":5.0 }, "max":{ "Review_ID":670801367.0, "Rating":5.0 } } # Randome sample of 10 rows from the dataframe. df_random_sample = { "count":{ "Review_ID":42656.0, "Rating":42656.0 }, "mean":{ "Review_ID":318855269.8283711672, "Rating":4.2176950488 }, "std":{ "Review_ID":165709224.260283798, "Rating":1.0633710689 }, "min":{ "Review_ID":1398724.0, "Rating":1.0 }, "25%":{ "Review_ID":174327393.0, "Rating":4.0 }, "50%":{ "Review_ID":290758265.0, "Rating":5.0 }, "75%":{ "Review_ID":448957905.75, "Rating":5.0 }, "max":{ "Review_ID":670801367.0, "Rating":5.0 } } ''' The question categories are: - boolean: Valid answers include True/False, Y/N, Yes/No (all case insensitive). - category: A value from a cell (or a substring of a cell) in the dataset. - number: A numerical value from a cell in the dataset, which may represent a computed statistic (e.g., average, maximum, minimum). - list[category]: A list containing a fixed number of categories. The expected format is: "['cat', 'dog']". Pay attention to the wording of the question to determine if uniqueness is required or if repeated values are allowed. - list[number]: Similar to list[category], but with numbers as its elements. ''' # TODO: complete the following function in one line, by completing the return statement. It should give the answer to: How many rows are there in this dataframe? def example(df: pd.DataFrame): df.columns=["A"] # Expected output type: is number, this will be checked. return df.shape[0] # It should give the answer to: What are the bottom 3 reviewer locations in terms of average rating? # The answer should only contain python code, you are not allowed leave any TODO undone. def answer(df: pd.DataFrame): # Use df to answer: What are the bottom 3 reviewer locations in terms of average rating? df.columns = ['Review_ID', 'Rating', 'Year_Month', 'Reviewer_Location', 'Review_Text', 'Branch'] # Expected output type: is list[category], this will be checked. return
20250129013724
236
What are the highest 5 review IDs in terms of rating? If you find a tie then keep the highest IDs.
061_Disneyland
dev
list[number]
['Review_ID', 'Rating']
dev
# Instructions: Generate ONLY python code. Do not include explanations. # you can use pandas and numpy. Use the meta data information from df_schema, df_descprtion. import pandas as pd import numpy as np # Description of dataframe schema. df_schema = { "columns": [ { "name": "Review_ID", "type": "uint32" }, { "name": "Rating", "type": "uint8" }, { "name": "Year_Month", "type": "category" }, { "name": "Reviewer_Location", "type": "category" }, { "name": "Review_Text", "type": "object" }, { "name": "Branch", "type": "category" } ] } # Description of dataframe columns. df_descrption = { "count":{ "Review_ID":42656.0, "Rating":42656.0 }, "mean":{ "Review_ID":318855269.8283711672, "Rating":4.2176950488 }, "std":{ "Review_ID":165709224.260283798, "Rating":1.0633710689 }, "min":{ "Review_ID":1398724.0, "Rating":1.0 }, "25%":{ "Review_ID":174327393.0, "Rating":4.0 }, "50%":{ "Review_ID":290758265.0, "Rating":5.0 }, "75%":{ "Review_ID":448957905.75, "Rating":5.0 }, "max":{ "Review_ID":670801367.0, "Rating":5.0 } } # Randome sample of 10 rows from the dataframe. df_random_sample = { "count":{ "Review_ID":42656.0, "Rating":42656.0 }, "mean":{ "Review_ID":318855269.8283711672, "Rating":4.2176950488 }, "std":{ "Review_ID":165709224.260283798, "Rating":1.0633710689 }, "min":{ "Review_ID":1398724.0, "Rating":1.0 }, "25%":{ "Review_ID":174327393.0, "Rating":4.0 }, "50%":{ "Review_ID":290758265.0, "Rating":5.0 }, "75%":{ "Review_ID":448957905.75, "Rating":5.0 }, "max":{ "Review_ID":670801367.0, "Rating":5.0 } } ''' The question categories are: - boolean: Valid answers include True/False, Y/N, Yes/No (all case insensitive). - category: A value from a cell (or a substring of a cell) in the dataset. - number: A numerical value from a cell in the dataset, which may represent a computed statistic (e.g., average, maximum, minimum). - list[category]: A list containing a fixed number of categories. The expected format is: "['cat', 'dog']". Pay attention to the wording of the question to determine if uniqueness is required or if repeated values are allowed. - list[number]: Similar to list[category], but with numbers as its elements. ''' # TODO: complete the following function in one line, by completing the return statement. It should give the answer to: How many rows are there in this dataframe? def example(df: pd.DataFrame): df.columns=["A"] # Expected output type: is number, this will be checked. return df.shape[0] # It should give the answer to: What are the highest 5 review IDs in terms of rating? If you find a tie then keep the highest IDs. # The answer should only contain python code, you are not allowed leave any TODO undone. def answer(df: pd.DataFrame): # Use df to answer: What are the highest 5 review IDs in terms of rating? If you find a tie then keep the highest IDs. df.columns = ['Review_ID', 'Rating', 'Year_Month', 'Reviewer_Location', 'Review_Text', 'Branch'] # Expected output type: is list[number], this will be checked. return
20250129013724
237
What are the lowest 4 review IDs in terms of rating? If there are more than four with the same rating keep the lowest IDs
061_Disneyland
dev
list[number]
['Review_ID', 'Rating']
dev
# Instructions: Generate ONLY python code. Do not include explanations. # you can use pandas and numpy. Use the meta data information from df_schema, df_descprtion. import pandas as pd import numpy as np # Description of dataframe schema. df_schema = { "columns": [ { "name": "Review_ID", "type": "uint32" }, { "name": "Rating", "type": "uint8" }, { "name": "Year_Month", "type": "category" }, { "name": "Reviewer_Location", "type": "category" }, { "name": "Review_Text", "type": "object" }, { "name": "Branch", "type": "category" } ] } # Description of dataframe columns. df_descrption = { "count":{ "Review_ID":42656.0, "Rating":42656.0 }, "mean":{ "Review_ID":318855269.8283711672, "Rating":4.2176950488 }, "std":{ "Review_ID":165709224.260283798, "Rating":1.0633710689 }, "min":{ "Review_ID":1398724.0, "Rating":1.0 }, "25%":{ "Review_ID":174327393.0, "Rating":4.0 }, "50%":{ "Review_ID":290758265.0, "Rating":5.0 }, "75%":{ "Review_ID":448957905.75, "Rating":5.0 }, "max":{ "Review_ID":670801367.0, "Rating":5.0 } } # Randome sample of 10 rows from the dataframe. df_random_sample = { "count":{ "Review_ID":42656.0, "Rating":42656.0 }, "mean":{ "Review_ID":318855269.8283711672, "Rating":4.2176950488 }, "std":{ "Review_ID":165709224.260283798, "Rating":1.0633710689 }, "min":{ "Review_ID":1398724.0, "Rating":1.0 }, "25%":{ "Review_ID":174327393.0, "Rating":4.0 }, "50%":{ "Review_ID":290758265.0, "Rating":5.0 }, "75%":{ "Review_ID":448957905.75, "Rating":5.0 }, "max":{ "Review_ID":670801367.0, "Rating":5.0 } } ''' The question categories are: - boolean: Valid answers include True/False, Y/N, Yes/No (all case insensitive). - category: A value from a cell (or a substring of a cell) in the dataset. - number: A numerical value from a cell in the dataset, which may represent a computed statistic (e.g., average, maximum, minimum). - list[category]: A list containing a fixed number of categories. The expected format is: "['cat', 'dog']". Pay attention to the wording of the question to determine if uniqueness is required or if repeated values are allowed. - list[number]: Similar to list[category], but with numbers as its elements. ''' # TODO: complete the following function in one line, by completing the return statement. It should give the answer to: How many rows are there in this dataframe? def example(df: pd.DataFrame): df.columns=["A"] # Expected output type: is number, this will be checked. return df.shape[0] # It should give the answer to: What are the lowest 4 review IDs in terms of rating? If there are more than four with the same rating keep the lowest IDs # The answer should only contain python code, you are not allowed leave any TODO undone. def answer(df: pd.DataFrame): # Use df to answer: What are the lowest 4 review IDs in terms of rating? If there are more than four with the same rating keep the lowest IDs df.columns = ['Review_ID', 'Rating', 'Year_Month', 'Reviewer_Location', 'Review_Text', 'Branch'] # Expected output type: is list[number], this will be checked. return
20250129013724
238
What are the top 3 (not necessarily unique) ratings given by reviewers from Australia?
061_Disneyland
dev
list[number]
['Reviewer_Location', 'Rating']
dev
# Instructions: Generate ONLY python code. Do not include explanations. # you can use pandas and numpy. Use the meta data information from df_schema, df_descprtion. import pandas as pd import numpy as np # Description of dataframe schema. df_schema = { "columns": [ { "name": "Review_ID", "type": "uint32" }, { "name": "Rating", "type": "uint8" }, { "name": "Year_Month", "type": "category" }, { "name": "Reviewer_Location", "type": "category" }, { "name": "Review_Text", "type": "object" }, { "name": "Branch", "type": "category" } ] } # Description of dataframe columns. df_descrption = { "count":{ "Review_ID":42656.0, "Rating":42656.0 }, "mean":{ "Review_ID":318855269.8283711672, "Rating":4.2176950488 }, "std":{ "Review_ID":165709224.260283798, "Rating":1.0633710689 }, "min":{ "Review_ID":1398724.0, "Rating":1.0 }, "25%":{ "Review_ID":174327393.0, "Rating":4.0 }, "50%":{ "Review_ID":290758265.0, "Rating":5.0 }, "75%":{ "Review_ID":448957905.75, "Rating":5.0 }, "max":{ "Review_ID":670801367.0, "Rating":5.0 } } # Randome sample of 10 rows from the dataframe. df_random_sample = { "count":{ "Review_ID":42656.0, "Rating":42656.0 }, "mean":{ "Review_ID":318855269.8283711672, "Rating":4.2176950488 }, "std":{ "Review_ID":165709224.260283798, "Rating":1.0633710689 }, "min":{ "Review_ID":1398724.0, "Rating":1.0 }, "25%":{ "Review_ID":174327393.0, "Rating":4.0 }, "50%":{ "Review_ID":290758265.0, "Rating":5.0 }, "75%":{ "Review_ID":448957905.75, "Rating":5.0 }, "max":{ "Review_ID":670801367.0, "Rating":5.0 } } ''' The question categories are: - boolean: Valid answers include True/False, Y/N, Yes/No (all case insensitive). - category: A value from a cell (or a substring of a cell) in the dataset. - number: A numerical value from a cell in the dataset, which may represent a computed statistic (e.g., average, maximum, minimum). - list[category]: A list containing a fixed number of categories. The expected format is: "['cat', 'dog']". Pay attention to the wording of the question to determine if uniqueness is required or if repeated values are allowed. - list[number]: Similar to list[category], but with numbers as its elements. ''' # TODO: complete the following function in one line, by completing the return statement. It should give the answer to: How many rows are there in this dataframe? def example(df: pd.DataFrame): df.columns=["A"] # Expected output type: is number, this will be checked. return df.shape[0] # It should give the answer to: What are the top 3 (not necessarily unique) ratings given by reviewers from Australia? # The answer should only contain python code, you are not allowed leave any TODO undone. def answer(df: pd.DataFrame): # Use df to answer: What are the top 3 (not necessarily unique) ratings given by reviewers from Australia? df.columns = ['Review_ID', 'Rating', 'Year_Month', 'Reviewer_Location', 'Review_Text', 'Branch'] # Expected output type: is list[number], this will be checked. return
20250129013724
239
What are the lowest 2 ratings given for Disneyland_HongKong?
061_Disneyland
dev
list[number]
['Branch', 'Rating']
dev
# Instructions: Generate ONLY python code. Do not include explanations. # you can use pandas and numpy. Use the meta data information from df_schema, df_descprtion. import pandas as pd import numpy as np # Description of dataframe schema. df_schema = { "columns": [ { "name": "Review_ID", "type": "uint32" }, { "name": "Rating", "type": "uint8" }, { "name": "Year_Month", "type": "category" }, { "name": "Reviewer_Location", "type": "category" }, { "name": "Review_Text", "type": "object" }, { "name": "Branch", "type": "category" } ] } # Description of dataframe columns. df_descrption = { "count":{ "Review_ID":42656.0, "Rating":42656.0 }, "mean":{ "Review_ID":318855269.8283711672, "Rating":4.2176950488 }, "std":{ "Review_ID":165709224.260283798, "Rating":1.0633710689 }, "min":{ "Review_ID":1398724.0, "Rating":1.0 }, "25%":{ "Review_ID":174327393.0, "Rating":4.0 }, "50%":{ "Review_ID":290758265.0, "Rating":5.0 }, "75%":{ "Review_ID":448957905.75, "Rating":5.0 }, "max":{ "Review_ID":670801367.0, "Rating":5.0 } } # Randome sample of 10 rows from the dataframe. df_random_sample = { "count":{ "Review_ID":42656.0, "Rating":42656.0 }, "mean":{ "Review_ID":318855269.8283711672, "Rating":4.2176950488 }, "std":{ "Review_ID":165709224.260283798, "Rating":1.0633710689 }, "min":{ "Review_ID":1398724.0, "Rating":1.0 }, "25%":{ "Review_ID":174327393.0, "Rating":4.0 }, "50%":{ "Review_ID":290758265.0, "Rating":5.0 }, "75%":{ "Review_ID":448957905.75, "Rating":5.0 }, "max":{ "Review_ID":670801367.0, "Rating":5.0 } } ''' The question categories are: - boolean: Valid answers include True/False, Y/N, Yes/No (all case insensitive). - category: A value from a cell (or a substring of a cell) in the dataset. - number: A numerical value from a cell in the dataset, which may represent a computed statistic (e.g., average, maximum, minimum). - list[category]: A list containing a fixed number of categories. The expected format is: "['cat', 'dog']". Pay attention to the wording of the question to determine if uniqueness is required or if repeated values are allowed. - list[number]: Similar to list[category], but with numbers as its elements. ''' # TODO: complete the following function in one line, by completing the return statement. It should give the answer to: How many rows are there in this dataframe? def example(df: pd.DataFrame): df.columns=["A"] # Expected output type: is number, this will be checked. return df.shape[0] # It should give the answer to: What are the lowest 2 ratings given for Disneyland_HongKong? # The answer should only contain python code, you are not allowed leave any TODO undone. def answer(df: pd.DataFrame): # Use df to answer: What are the lowest 2 ratings given for Disneyland_HongKong? df.columns = ['Review_ID', 'Rating', 'Year_Month', 'Reviewer_Location', 'Review_Text', 'Branch'] # Expected output type: is list[number], this will be checked. return
20250129013724
240
Are all the tweets in English?
062_Trump
dev
boolean
['lang']
dev
# Instructions: Generate ONLY python code. Do not include explanations. # you can use pandas and numpy. Use the meta data information from df_schema, df_descprtion. import pandas as pd import numpy as np # Description of dataframe schema. df_schema = { "columns": [ { "name": "id", "type": "int64" }, { "name": "author_id", "type": "uint32" }, { "name": "author_name", "type": "category" }, { "name": "author_handler", "type": "category" }, { "name": "author_avatar", "type": "category" }, { "name": "lang", "type": "category" }, { "name": "text", "type": "object" }, { "name": "date", "type": "datetime64[ns, UTC]" }, { "name": "mention_ids", "type": "object" }, { "name": "mention_names", "type": "object" }, { "name": "retweets", "type": "uint32" }, { "name": "favorites", "type": "uint32" }, { "name": "links", "type": "object" }, { "name": "links_first", "type": "category" }, { "name": "image_links", "type": "object" }, { "name": "image_links_first", "type": "category" }, { "name": "tweet_link", "type": "category" }, { "name": "rp_user_id", "type": "float64" }, { "name": "rp_user_name", "type": "category" }, { "name": "location", "type": "category" } ] } # Description of dataframe columns. df_descrption = { "count":{ "id":15039.0, "author_id":15039.0, "retweets":15039.0, "favorites":15039.0, "rp_user_id":38.0 }, "mean":{ "id":7.708974475e+17, "author_id":25073877.0, "retweets":8774.5204468382, "favorites":34438.8956712547, "rp_user_id":409658793.0 }, "std":{ "id":1.524628348e+17, "author_id":0.0, "retweets":11471.4259073933, "favorites":43738.3620217327, "rp_user_id":973036746.0114293098 }, "min":{ "id":5.755855984e+17, "author_id":25073877.0, "retweets":1.0, "favorites":1.0, "rp_user_id":1457641.0 }, "25%":{ "id":6.452230056e+17, "author_id":25073877.0, "retweets":702.5, "favorites":1522.0, "rp_user_id":25073877.0 }, "50%":{ "id":7.232668993e+17, "author_id":25073877.0, "retweets":4216.0, "favorites":11854.0, "rp_user_id":25073877.0 }, "75%":{ "id":9.053052425e+17, "author_id":25073877.0, "retweets":14414.5, "favorites":63094.5, "rp_user_id":99623321.25 }, "max":{ "id":1.075621116e+18, "author_id":25073877.0, "retweets":334538.0, "favorites":589793.0, "rp_user_id":3412873425.0 } } # Randome sample of 10 rows from the dataframe. df_random_sample = { "count":{ "id":15039.0, "author_id":15039.0, "retweets":15039.0, "favorites":15039.0, "rp_user_id":38.0 }, "mean":{ "id":7.708974475e+17, "author_id":25073877.0, "retweets":8774.5204468382, "favorites":34438.8956712547, "rp_user_id":409658793.0 }, "std":{ "id":1.524628348e+17, "author_id":0.0, "retweets":11471.4259073933, "favorites":43738.3620217327, "rp_user_id":973036746.0114293098 }, "min":{ "id":5.755855984e+17, "author_id":25073877.0, "retweets":1.0, "favorites":1.0, "rp_user_id":1457641.0 }, "25%":{ "id":6.452230056e+17, "author_id":25073877.0, "retweets":702.5, "favorites":1522.0, "rp_user_id":25073877.0 }, "50%":{ "id":7.232668993e+17, "author_id":25073877.0, "retweets":4216.0, "favorites":11854.0, "rp_user_id":25073877.0 }, "75%":{ "id":9.053052425e+17, "author_id":25073877.0, "retweets":14414.5, "favorites":63094.5, "rp_user_id":99623321.25 }, "max":{ "id":1.075621116e+18, "author_id":25073877.0, "retweets":334538.0, "favorites":589793.0, "rp_user_id":3412873425.0 } } ''' The question categories are: - boolean: Valid answers include True/False, Y/N, Yes/No (all case insensitive). - category: A value from a cell (or a substring of a cell) in the dataset. - number: A numerical value from a cell in the dataset, which may represent a computed statistic (e.g., average, maximum, minimum). - list[category]: A list containing a fixed number of categories. The expected format is: "['cat', 'dog']". Pay attention to the wording of the question to determine if uniqueness is required or if repeated values are allowed. - list[number]: Similar to list[category], but with numbers as its elements. ''' # TODO: complete the following function in one line, by completing the return statement. It should give the answer to: How many rows are there in this dataframe? def example(df: pd.DataFrame): df.columns=["A"] # Expected output type: is number, this will be checked. return df.shape[0] # It should give the answer to: Are all the tweets in English? # The answer should only contain python code, you are not allowed leave any TODO undone. def answer(df: pd.DataFrame): # Use df to answer: Are all the tweets in English? df.columns = ['id', 'author_id', 'author_name', 'author_handler', 'author_avatar', 'lang', 'text', 'date', 'mention_ids', 'mention_names', 'retweets', 'favorites', 'links', 'links_first', 'image_links', 'image_links_first', 'tweet_link', 'rp_user_id', 'rp_user_name', 'location'] # Expected output type: is boolean, this will be checked. return
20250129013724
241
Has the author ever been retweeted?
062_Trump
dev
boolean
['retweets']
dev
# Instructions: Generate ONLY python code. Do not include explanations. # you can use pandas and numpy. Use the meta data information from df_schema, df_descprtion. import pandas as pd import numpy as np # Description of dataframe schema. df_schema = { "columns": [ { "name": "id", "type": "int64" }, { "name": "author_id", "type": "uint32" }, { "name": "author_name", "type": "category" }, { "name": "author_handler", "type": "category" }, { "name": "author_avatar", "type": "category" }, { "name": "lang", "type": "category" }, { "name": "text", "type": "object" }, { "name": "date", "type": "datetime64[ns, UTC]" }, { "name": "mention_ids", "type": "object" }, { "name": "mention_names", "type": "object" }, { "name": "retweets", "type": "uint32" }, { "name": "favorites", "type": "uint32" }, { "name": "links", "type": "object" }, { "name": "links_first", "type": "category" }, { "name": "image_links", "type": "object" }, { "name": "image_links_first", "type": "category" }, { "name": "tweet_link", "type": "category" }, { "name": "rp_user_id", "type": "float64" }, { "name": "rp_user_name", "type": "category" }, { "name": "location", "type": "category" } ] } # Description of dataframe columns. df_descrption = { "count":{ "id":15039.0, "author_id":15039.0, "retweets":15039.0, "favorites":15039.0, "rp_user_id":38.0 }, "mean":{ "id":7.708974475e+17, "author_id":25073877.0, "retweets":8774.5204468382, "favorites":34438.8956712547, "rp_user_id":409658793.0 }, "std":{ "id":1.524628348e+17, "author_id":0.0, "retweets":11471.4259073933, "favorites":43738.3620217327, "rp_user_id":973036746.0114293098 }, "min":{ "id":5.755855984e+17, "author_id":25073877.0, "retweets":1.0, "favorites":1.0, "rp_user_id":1457641.0 }, "25%":{ "id":6.452230056e+17, "author_id":25073877.0, "retweets":702.5, "favorites":1522.0, "rp_user_id":25073877.0 }, "50%":{ "id":7.232668993e+17, "author_id":25073877.0, "retweets":4216.0, "favorites":11854.0, "rp_user_id":25073877.0 }, "75%":{ "id":9.053052425e+17, "author_id":25073877.0, "retweets":14414.5, "favorites":63094.5, "rp_user_id":99623321.25 }, "max":{ "id":1.075621116e+18, "author_id":25073877.0, "retweets":334538.0, "favorites":589793.0, "rp_user_id":3412873425.0 } } # Randome sample of 10 rows from the dataframe. df_random_sample = { "count":{ "id":15039.0, "author_id":15039.0, "retweets":15039.0, "favorites":15039.0, "rp_user_id":38.0 }, "mean":{ "id":7.708974475e+17, "author_id":25073877.0, "retweets":8774.5204468382, "favorites":34438.8956712547, "rp_user_id":409658793.0 }, "std":{ "id":1.524628348e+17, "author_id":0.0, "retweets":11471.4259073933, "favorites":43738.3620217327, "rp_user_id":973036746.0114293098 }, "min":{ "id":5.755855984e+17, "author_id":25073877.0, "retweets":1.0, "favorites":1.0, "rp_user_id":1457641.0 }, "25%":{ "id":6.452230056e+17, "author_id":25073877.0, "retweets":702.5, "favorites":1522.0, "rp_user_id":25073877.0 }, "50%":{ "id":7.232668993e+17, "author_id":25073877.0, "retweets":4216.0, "favorites":11854.0, "rp_user_id":25073877.0 }, "75%":{ "id":9.053052425e+17, "author_id":25073877.0, "retweets":14414.5, "favorites":63094.5, "rp_user_id":99623321.25 }, "max":{ "id":1.075621116e+18, "author_id":25073877.0, "retweets":334538.0, "favorites":589793.0, "rp_user_id":3412873425.0 } } ''' The question categories are: - boolean: Valid answers include True/False, Y/N, Yes/No (all case insensitive). - category: A value from a cell (or a substring of a cell) in the dataset. - number: A numerical value from a cell in the dataset, which may represent a computed statistic (e.g., average, maximum, minimum). - list[category]: A list containing a fixed number of categories. The expected format is: "['cat', 'dog']". Pay attention to the wording of the question to determine if uniqueness is required or if repeated values are allowed. - list[number]: Similar to list[category], but with numbers as its elements. ''' # TODO: complete the following function in one line, by completing the return statement. It should give the answer to: How many rows are there in this dataframe? def example(df: pd.DataFrame): df.columns=["A"] # Expected output type: is number, this will be checked. return df.shape[0] # It should give the answer to: Has the author ever been retweeted? # The answer should only contain python code, you are not allowed leave any TODO undone. def answer(df: pd.DataFrame): # Use df to answer: Has the author ever been retweeted? df.columns = ['id', 'author_id', 'author_name', 'author_handler', 'author_avatar', 'lang', 'text', 'date', 'mention_ids', 'mention_names', 'retweets', 'favorites', 'links', 'links_first', 'image_links', 'image_links_first', 'tweet_link', 'rp_user_id', 'rp_user_name', 'location'] # Expected output type: is boolean, this will be checked. return
20250129013724
242
Are there any tweets with more than 10000 retweets?
062_Trump
dev
boolean
['retweets']
dev
# Instructions: Generate ONLY python code. Do not include explanations. # you can use pandas and numpy. Use the meta data information from df_schema, df_descprtion. import pandas as pd import numpy as np # Description of dataframe schema. df_schema = { "columns": [ { "name": "id", "type": "int64" }, { "name": "author_id", "type": "uint32" }, { "name": "author_name", "type": "category" }, { "name": "author_handler", "type": "category" }, { "name": "author_avatar", "type": "category" }, { "name": "lang", "type": "category" }, { "name": "text", "type": "object" }, { "name": "date", "type": "datetime64[ns, UTC]" }, { "name": "mention_ids", "type": "object" }, { "name": "mention_names", "type": "object" }, { "name": "retweets", "type": "uint32" }, { "name": "favorites", "type": "uint32" }, { "name": "links", "type": "object" }, { "name": "links_first", "type": "category" }, { "name": "image_links", "type": "object" }, { "name": "image_links_first", "type": "category" }, { "name": "tweet_link", "type": "category" }, { "name": "rp_user_id", "type": "float64" }, { "name": "rp_user_name", "type": "category" }, { "name": "location", "type": "category" } ] } # Description of dataframe columns. df_descrption = { "count":{ "id":15039.0, "author_id":15039.0, "retweets":15039.0, "favorites":15039.0, "rp_user_id":38.0 }, "mean":{ "id":7.708974475e+17, "author_id":25073877.0, "retweets":8774.5204468382, "favorites":34438.8956712547, "rp_user_id":409658793.0 }, "std":{ "id":1.524628348e+17, "author_id":0.0, "retweets":11471.4259073933, "favorites":43738.3620217327, "rp_user_id":973036746.0114293098 }, "min":{ "id":5.755855984e+17, "author_id":25073877.0, "retweets":1.0, "favorites":1.0, "rp_user_id":1457641.0 }, "25%":{ "id":6.452230056e+17, "author_id":25073877.0, "retweets":702.5, "favorites":1522.0, "rp_user_id":25073877.0 }, "50%":{ "id":7.232668993e+17, "author_id":25073877.0, "retweets":4216.0, "favorites":11854.0, "rp_user_id":25073877.0 }, "75%":{ "id":9.053052425e+17, "author_id":25073877.0, "retweets":14414.5, "favorites":63094.5, "rp_user_id":99623321.25 }, "max":{ "id":1.075621116e+18, "author_id":25073877.0, "retweets":334538.0, "favorites":589793.0, "rp_user_id":3412873425.0 } } # Randome sample of 10 rows from the dataframe. df_random_sample = { "count":{ "id":15039.0, "author_id":15039.0, "retweets":15039.0, "favorites":15039.0, "rp_user_id":38.0 }, "mean":{ "id":7.708974475e+17, "author_id":25073877.0, "retweets":8774.5204468382, "favorites":34438.8956712547, "rp_user_id":409658793.0 }, "std":{ "id":1.524628348e+17, "author_id":0.0, "retweets":11471.4259073933, "favorites":43738.3620217327, "rp_user_id":973036746.0114293098 }, "min":{ "id":5.755855984e+17, "author_id":25073877.0, "retweets":1.0, "favorites":1.0, "rp_user_id":1457641.0 }, "25%":{ "id":6.452230056e+17, "author_id":25073877.0, "retweets":702.5, "favorites":1522.0, "rp_user_id":25073877.0 }, "50%":{ "id":7.232668993e+17, "author_id":25073877.0, "retweets":4216.0, "favorites":11854.0, "rp_user_id":25073877.0 }, "75%":{ "id":9.053052425e+17, "author_id":25073877.0, "retweets":14414.5, "favorites":63094.5, "rp_user_id":99623321.25 }, "max":{ "id":1.075621116e+18, "author_id":25073877.0, "retweets":334538.0, "favorites":589793.0, "rp_user_id":3412873425.0 } } ''' The question categories are: - boolean: Valid answers include True/False, Y/N, Yes/No (all case insensitive). - category: A value from a cell (or a substring of a cell) in the dataset. - number: A numerical value from a cell in the dataset, which may represent a computed statistic (e.g., average, maximum, minimum). - list[category]: A list containing a fixed number of categories. The expected format is: "['cat', 'dog']". Pay attention to the wording of the question to determine if uniqueness is required or if repeated values are allowed. - list[number]: Similar to list[category], but with numbers as its elements. ''' # TODO: complete the following function in one line, by completing the return statement. It should give the answer to: How many rows are there in this dataframe? def example(df: pd.DataFrame): df.columns=["A"] # Expected output type: is number, this will be checked. return df.shape[0] # It should give the answer to: Are there any tweets with more than 10000 retweets? # The answer should only contain python code, you are not allowed leave any TODO undone. def answer(df: pd.DataFrame): # Use df to answer: Are there any tweets with more than 10000 retweets? df.columns = ['id', 'author_id', 'author_name', 'author_handler', 'author_avatar', 'lang', 'text', 'date', 'mention_ids', 'mention_names', 'retweets', 'favorites', 'links', 'links_first', 'image_links', 'image_links_first', 'tweet_link', 'rp_user_id', 'rp_user_name', 'location'] # Expected output type: is boolean, this will be checked. return
20250129013724
243
Have any of the tweets been favorited more than 50000 times?
062_Trump
dev
boolean
['favorites']
dev
# Instructions: Generate ONLY python code. Do not include explanations. # you can use pandas and numpy. Use the meta data information from df_schema, df_descprtion. import pandas as pd import numpy as np # Description of dataframe schema. df_schema = { "columns": [ { "name": "id", "type": "int64" }, { "name": "author_id", "type": "uint32" }, { "name": "author_name", "type": "category" }, { "name": "author_handler", "type": "category" }, { "name": "author_avatar", "type": "category" }, { "name": "lang", "type": "category" }, { "name": "text", "type": "object" }, { "name": "date", "type": "datetime64[ns, UTC]" }, { "name": "mention_ids", "type": "object" }, { "name": "mention_names", "type": "object" }, { "name": "retweets", "type": "uint32" }, { "name": "favorites", "type": "uint32" }, { "name": "links", "type": "object" }, { "name": "links_first", "type": "category" }, { "name": "image_links", "type": "object" }, { "name": "image_links_first", "type": "category" }, { "name": "tweet_link", "type": "category" }, { "name": "rp_user_id", "type": "float64" }, { "name": "rp_user_name", "type": "category" }, { "name": "location", "type": "category" } ] } # Description of dataframe columns. df_descrption = { "count":{ "id":15039.0, "author_id":15039.0, "retweets":15039.0, "favorites":15039.0, "rp_user_id":38.0 }, "mean":{ "id":7.708974475e+17, "author_id":25073877.0, "retweets":8774.5204468382, "favorites":34438.8956712547, "rp_user_id":409658793.0 }, "std":{ "id":1.524628348e+17, "author_id":0.0, "retweets":11471.4259073933, "favorites":43738.3620217327, "rp_user_id":973036746.0114293098 }, "min":{ "id":5.755855984e+17, "author_id":25073877.0, "retweets":1.0, "favorites":1.0, "rp_user_id":1457641.0 }, "25%":{ "id":6.452230056e+17, "author_id":25073877.0, "retweets":702.5, "favorites":1522.0, "rp_user_id":25073877.0 }, "50%":{ "id":7.232668993e+17, "author_id":25073877.0, "retweets":4216.0, "favorites":11854.0, "rp_user_id":25073877.0 }, "75%":{ "id":9.053052425e+17, "author_id":25073877.0, "retweets":14414.5, "favorites":63094.5, "rp_user_id":99623321.25 }, "max":{ "id":1.075621116e+18, "author_id":25073877.0, "retweets":334538.0, "favorites":589793.0, "rp_user_id":3412873425.0 } } # Randome sample of 10 rows from the dataframe. df_random_sample = { "count":{ "id":15039.0, "author_id":15039.0, "retweets":15039.0, "favorites":15039.0, "rp_user_id":38.0 }, "mean":{ "id":7.708974475e+17, "author_id":25073877.0, "retweets":8774.5204468382, "favorites":34438.8956712547, "rp_user_id":409658793.0 }, "std":{ "id":1.524628348e+17, "author_id":0.0, "retweets":11471.4259073933, "favorites":43738.3620217327, "rp_user_id":973036746.0114293098 }, "min":{ "id":5.755855984e+17, "author_id":25073877.0, "retweets":1.0, "favorites":1.0, "rp_user_id":1457641.0 }, "25%":{ "id":6.452230056e+17, "author_id":25073877.0, "retweets":702.5, "favorites":1522.0, "rp_user_id":25073877.0 }, "50%":{ "id":7.232668993e+17, "author_id":25073877.0, "retweets":4216.0, "favorites":11854.0, "rp_user_id":25073877.0 }, "75%":{ "id":9.053052425e+17, "author_id":25073877.0, "retweets":14414.5, "favorites":63094.5, "rp_user_id":99623321.25 }, "max":{ "id":1.075621116e+18, "author_id":25073877.0, "retweets":334538.0, "favorites":589793.0, "rp_user_id":3412873425.0 } } ''' The question categories are: - boolean: Valid answers include True/False, Y/N, Yes/No (all case insensitive). - category: A value from a cell (or a substring of a cell) in the dataset. - number: A numerical value from a cell in the dataset, which may represent a computed statistic (e.g., average, maximum, minimum). - list[category]: A list containing a fixed number of categories. The expected format is: "['cat', 'dog']". Pay attention to the wording of the question to determine if uniqueness is required or if repeated values are allowed. - list[number]: Similar to list[category], but with numbers as its elements. ''' # TODO: complete the following function in one line, by completing the return statement. It should give the answer to: How many rows are there in this dataframe? def example(df: pd.DataFrame): df.columns=["A"] # Expected output type: is number, this will be checked. return df.shape[0] # It should give the answer to: Have any of the tweets been favorited more than 50000 times? # The answer should only contain python code, you are not allowed leave any TODO undone. def answer(df: pd.DataFrame): # Use df to answer: Have any of the tweets been favorited more than 50000 times? df.columns = ['id', 'author_id', 'author_name', 'author_handler', 'author_avatar', 'lang', 'text', 'date', 'mention_ids', 'mention_names', 'retweets', 'favorites', 'links', 'links_first', 'image_links', 'image_links_first', 'tweet_link', 'rp_user_id', 'rp_user_name', 'location'] # Expected output type: is boolean, this will be checked. return
20250129013724
244
How many unique authors are there?
062_Trump
dev
number
['author_name']
dev
# Instructions: Generate ONLY python code. Do not include explanations. # you can use pandas and numpy. Use the meta data information from df_schema, df_descprtion. import pandas as pd import numpy as np # Description of dataframe schema. df_schema = { "columns": [ { "name": "id", "type": "int64" }, { "name": "author_id", "type": "uint32" }, { "name": "author_name", "type": "category" }, { "name": "author_handler", "type": "category" }, { "name": "author_avatar", "type": "category" }, { "name": "lang", "type": "category" }, { "name": "text", "type": "object" }, { "name": "date", "type": "datetime64[ns, UTC]" }, { "name": "mention_ids", "type": "object" }, { "name": "mention_names", "type": "object" }, { "name": "retweets", "type": "uint32" }, { "name": "favorites", "type": "uint32" }, { "name": "links", "type": "object" }, { "name": "links_first", "type": "category" }, { "name": "image_links", "type": "object" }, { "name": "image_links_first", "type": "category" }, { "name": "tweet_link", "type": "category" }, { "name": "rp_user_id", "type": "float64" }, { "name": "rp_user_name", "type": "category" }, { "name": "location", "type": "category" } ] } # Description of dataframe columns. df_descrption = { "count":{ "id":15039.0, "author_id":15039.0, "retweets":15039.0, "favorites":15039.0, "rp_user_id":38.0 }, "mean":{ "id":7.708974475e+17, "author_id":25073877.0, "retweets":8774.5204468382, "favorites":34438.8956712547, "rp_user_id":409658793.0 }, "std":{ "id":1.524628348e+17, "author_id":0.0, "retweets":11471.4259073933, "favorites":43738.3620217327, "rp_user_id":973036746.0114293098 }, "min":{ "id":5.755855984e+17, "author_id":25073877.0, "retweets":1.0, "favorites":1.0, "rp_user_id":1457641.0 }, "25%":{ "id":6.452230056e+17, "author_id":25073877.0, "retweets":702.5, "favorites":1522.0, "rp_user_id":25073877.0 }, "50%":{ "id":7.232668993e+17, "author_id":25073877.0, "retweets":4216.0, "favorites":11854.0, "rp_user_id":25073877.0 }, "75%":{ "id":9.053052425e+17, "author_id":25073877.0, "retweets":14414.5, "favorites":63094.5, "rp_user_id":99623321.25 }, "max":{ "id":1.075621116e+18, "author_id":25073877.0, "retweets":334538.0, "favorites":589793.0, "rp_user_id":3412873425.0 } } # Randome sample of 10 rows from the dataframe. df_random_sample = { "count":{ "id":15039.0, "author_id":15039.0, "retweets":15039.0, "favorites":15039.0, "rp_user_id":38.0 }, "mean":{ "id":7.708974475e+17, "author_id":25073877.0, "retweets":8774.5204468382, "favorites":34438.8956712547, "rp_user_id":409658793.0 }, "std":{ "id":1.524628348e+17, "author_id":0.0, "retweets":11471.4259073933, "favorites":43738.3620217327, "rp_user_id":973036746.0114293098 }, "min":{ "id":5.755855984e+17, "author_id":25073877.0, "retweets":1.0, "favorites":1.0, "rp_user_id":1457641.0 }, "25%":{ "id":6.452230056e+17, "author_id":25073877.0, "retweets":702.5, "favorites":1522.0, "rp_user_id":25073877.0 }, "50%":{ "id":7.232668993e+17, "author_id":25073877.0, "retweets":4216.0, "favorites":11854.0, "rp_user_id":25073877.0 }, "75%":{ "id":9.053052425e+17, "author_id":25073877.0, "retweets":14414.5, "favorites":63094.5, "rp_user_id":99623321.25 }, "max":{ "id":1.075621116e+18, "author_id":25073877.0, "retweets":334538.0, "favorites":589793.0, "rp_user_id":3412873425.0 } } ''' The question categories are: - boolean: Valid answers include True/False, Y/N, Yes/No (all case insensitive). - category: A value from a cell (or a substring of a cell) in the dataset. - number: A numerical value from a cell in the dataset, which may represent a computed statistic (e.g., average, maximum, minimum). - list[category]: A list containing a fixed number of categories. The expected format is: "['cat', 'dog']". Pay attention to the wording of the question to determine if uniqueness is required or if repeated values are allowed. - list[number]: Similar to list[category], but with numbers as its elements. ''' # TODO: complete the following function in one line, by completing the return statement. It should give the answer to: How many rows are there in this dataframe? def example(df: pd.DataFrame): df.columns=["A"] # Expected output type: is number, this will be checked. return df.shape[0] # It should give the answer to: How many unique authors are there? # The answer should only contain python code, you are not allowed leave any TODO undone. def answer(df: pd.DataFrame): # Use df to answer: How many unique authors are there? df.columns = ['id', 'author_id', 'author_name', 'author_handler', 'author_avatar', 'lang', 'text', 'date', 'mention_ids', 'mention_names', 'retweets', 'favorites', 'links', 'links_first', 'image_links', 'image_links_first', 'tweet_link', 'rp_user_id', 'rp_user_name', 'location'] # Expected output type: is number, this will be checked. return
20250129013724
245
What is the average number of retweets?
062_Trump
dev
number
['retweets']
dev
# Instructions: Generate ONLY python code. Do not include explanations. # you can use pandas and numpy. Use the meta data information from df_schema, df_descprtion. import pandas as pd import numpy as np # Description of dataframe schema. df_schema = { "columns": [ { "name": "id", "type": "int64" }, { "name": "author_id", "type": "uint32" }, { "name": "author_name", "type": "category" }, { "name": "author_handler", "type": "category" }, { "name": "author_avatar", "type": "category" }, { "name": "lang", "type": "category" }, { "name": "text", "type": "object" }, { "name": "date", "type": "datetime64[ns, UTC]" }, { "name": "mention_ids", "type": "object" }, { "name": "mention_names", "type": "object" }, { "name": "retweets", "type": "uint32" }, { "name": "favorites", "type": "uint32" }, { "name": "links", "type": "object" }, { "name": "links_first", "type": "category" }, { "name": "image_links", "type": "object" }, { "name": "image_links_first", "type": "category" }, { "name": "tweet_link", "type": "category" }, { "name": "rp_user_id", "type": "float64" }, { "name": "rp_user_name", "type": "category" }, { "name": "location", "type": "category" } ] } # Description of dataframe columns. df_descrption = { "count":{ "id":15039.0, "author_id":15039.0, "retweets":15039.0, "favorites":15039.0, "rp_user_id":38.0 }, "mean":{ "id":7.708974475e+17, "author_id":25073877.0, "retweets":8774.5204468382, "favorites":34438.8956712547, "rp_user_id":409658793.0 }, "std":{ "id":1.524628348e+17, "author_id":0.0, "retweets":11471.4259073933, "favorites":43738.3620217327, "rp_user_id":973036746.0114293098 }, "min":{ "id":5.755855984e+17, "author_id":25073877.0, "retweets":1.0, "favorites":1.0, "rp_user_id":1457641.0 }, "25%":{ "id":6.452230056e+17, "author_id":25073877.0, "retweets":702.5, "favorites":1522.0, "rp_user_id":25073877.0 }, "50%":{ "id":7.232668993e+17, "author_id":25073877.0, "retweets":4216.0, "favorites":11854.0, "rp_user_id":25073877.0 }, "75%":{ "id":9.053052425e+17, "author_id":25073877.0, "retweets":14414.5, "favorites":63094.5, "rp_user_id":99623321.25 }, "max":{ "id":1.075621116e+18, "author_id":25073877.0, "retweets":334538.0, "favorites":589793.0, "rp_user_id":3412873425.0 } } # Randome sample of 10 rows from the dataframe. df_random_sample = { "count":{ "id":15039.0, "author_id":15039.0, "retweets":15039.0, "favorites":15039.0, "rp_user_id":38.0 }, "mean":{ "id":7.708974475e+17, "author_id":25073877.0, "retweets":8774.5204468382, "favorites":34438.8956712547, "rp_user_id":409658793.0 }, "std":{ "id":1.524628348e+17, "author_id":0.0, "retweets":11471.4259073933, "favorites":43738.3620217327, "rp_user_id":973036746.0114293098 }, "min":{ "id":5.755855984e+17, "author_id":25073877.0, "retweets":1.0, "favorites":1.0, "rp_user_id":1457641.0 }, "25%":{ "id":6.452230056e+17, "author_id":25073877.0, "retweets":702.5, "favorites":1522.0, "rp_user_id":25073877.0 }, "50%":{ "id":7.232668993e+17, "author_id":25073877.0, "retweets":4216.0, "favorites":11854.0, "rp_user_id":25073877.0 }, "75%":{ "id":9.053052425e+17, "author_id":25073877.0, "retweets":14414.5, "favorites":63094.5, "rp_user_id":99623321.25 }, "max":{ "id":1.075621116e+18, "author_id":25073877.0, "retweets":334538.0, "favorites":589793.0, "rp_user_id":3412873425.0 } } ''' The question categories are: - boolean: Valid answers include True/False, Y/N, Yes/No (all case insensitive). - category: A value from a cell (or a substring of a cell) in the dataset. - number: A numerical value from a cell in the dataset, which may represent a computed statistic (e.g., average, maximum, minimum). - list[category]: A list containing a fixed number of categories. The expected format is: "['cat', 'dog']". Pay attention to the wording of the question to determine if uniqueness is required or if repeated values are allowed. - list[number]: Similar to list[category], but with numbers as its elements. ''' # TODO: complete the following function in one line, by completing the return statement. It should give the answer to: How many rows are there in this dataframe? def example(df: pd.DataFrame): df.columns=["A"] # Expected output type: is number, this will be checked. return df.shape[0] # It should give the answer to: What is the average number of retweets? # The answer should only contain python code, you are not allowed leave any TODO undone. def answer(df: pd.DataFrame): # Use df to answer: What is the average number of retweets? df.columns = ['id', 'author_id', 'author_name', 'author_handler', 'author_avatar', 'lang', 'text', 'date', 'mention_ids', 'mention_names', 'retweets', 'favorites', 'links', 'links_first', 'image_links', 'image_links_first', 'tweet_link', 'rp_user_id', 'rp_user_name', 'location'] # Expected output type: is number, this will be checked. return
20250129013724
246
What is the maximum number of favorites received for a single tweet?
062_Trump
dev
number
['favorites']
dev
# Instructions: Generate ONLY python code. Do not include explanations. # you can use pandas and numpy. Use the meta data information from df_schema, df_descprtion. import pandas as pd import numpy as np # Description of dataframe schema. df_schema = { "columns": [ { "name": "id", "type": "int64" }, { "name": "author_id", "type": "uint32" }, { "name": "author_name", "type": "category" }, { "name": "author_handler", "type": "category" }, { "name": "author_avatar", "type": "category" }, { "name": "lang", "type": "category" }, { "name": "text", "type": "object" }, { "name": "date", "type": "datetime64[ns, UTC]" }, { "name": "mention_ids", "type": "object" }, { "name": "mention_names", "type": "object" }, { "name": "retweets", "type": "uint32" }, { "name": "favorites", "type": "uint32" }, { "name": "links", "type": "object" }, { "name": "links_first", "type": "category" }, { "name": "image_links", "type": "object" }, { "name": "image_links_first", "type": "category" }, { "name": "tweet_link", "type": "category" }, { "name": "rp_user_id", "type": "float64" }, { "name": "rp_user_name", "type": "category" }, { "name": "location", "type": "category" } ] } # Description of dataframe columns. df_descrption = { "count":{ "id":15039.0, "author_id":15039.0, "retweets":15039.0, "favorites":15039.0, "rp_user_id":38.0 }, "mean":{ "id":7.708974475e+17, "author_id":25073877.0, "retweets":8774.5204468382, "favorites":34438.8956712547, "rp_user_id":409658793.0 }, "std":{ "id":1.524628348e+17, "author_id":0.0, "retweets":11471.4259073933, "favorites":43738.3620217327, "rp_user_id":973036746.0114293098 }, "min":{ "id":5.755855984e+17, "author_id":25073877.0, "retweets":1.0, "favorites":1.0, "rp_user_id":1457641.0 }, "25%":{ "id":6.452230056e+17, "author_id":25073877.0, "retweets":702.5, "favorites":1522.0, "rp_user_id":25073877.0 }, "50%":{ "id":7.232668993e+17, "author_id":25073877.0, "retweets":4216.0, "favorites":11854.0, "rp_user_id":25073877.0 }, "75%":{ "id":9.053052425e+17, "author_id":25073877.0, "retweets":14414.5, "favorites":63094.5, "rp_user_id":99623321.25 }, "max":{ "id":1.075621116e+18, "author_id":25073877.0, "retweets":334538.0, "favorites":589793.0, "rp_user_id":3412873425.0 } } # Randome sample of 10 rows from the dataframe. df_random_sample = { "count":{ "id":15039.0, "author_id":15039.0, "retweets":15039.0, "favorites":15039.0, "rp_user_id":38.0 }, "mean":{ "id":7.708974475e+17, "author_id":25073877.0, "retweets":8774.5204468382, "favorites":34438.8956712547, "rp_user_id":409658793.0 }, "std":{ "id":1.524628348e+17, "author_id":0.0, "retweets":11471.4259073933, "favorites":43738.3620217327, "rp_user_id":973036746.0114293098 }, "min":{ "id":5.755855984e+17, "author_id":25073877.0, "retweets":1.0, "favorites":1.0, "rp_user_id":1457641.0 }, "25%":{ "id":6.452230056e+17, "author_id":25073877.0, "retweets":702.5, "favorites":1522.0, "rp_user_id":25073877.0 }, "50%":{ "id":7.232668993e+17, "author_id":25073877.0, "retweets":4216.0, "favorites":11854.0, "rp_user_id":25073877.0 }, "75%":{ "id":9.053052425e+17, "author_id":25073877.0, "retweets":14414.5, "favorites":63094.5, "rp_user_id":99623321.25 }, "max":{ "id":1.075621116e+18, "author_id":25073877.0, "retweets":334538.0, "favorites":589793.0, "rp_user_id":3412873425.0 } } ''' The question categories are: - boolean: Valid answers include True/False, Y/N, Yes/No (all case insensitive). - category: A value from a cell (or a substring of a cell) in the dataset. - number: A numerical value from a cell in the dataset, which may represent a computed statistic (e.g., average, maximum, minimum). - list[category]: A list containing a fixed number of categories. The expected format is: "['cat', 'dog']". Pay attention to the wording of the question to determine if uniqueness is required or if repeated values are allowed. - list[number]: Similar to list[category], but with numbers as its elements. ''' # TODO: complete the following function in one line, by completing the return statement. It should give the answer to: How many rows are there in this dataframe? def example(df: pd.DataFrame): df.columns=["A"] # Expected output type: is number, this will be checked. return df.shape[0] # It should give the answer to: What is the maximum number of favorites received for a single tweet? # The answer should only contain python code, you are not allowed leave any TODO undone. def answer(df: pd.DataFrame): # Use df to answer: What is the maximum number of favorites received for a single tweet? df.columns = ['id', 'author_id', 'author_name', 'author_handler', 'author_avatar', 'lang', 'text', 'date', 'mention_ids', 'mention_names', 'retweets', 'favorites', 'links', 'links_first', 'image_links', 'image_links_first', 'tweet_link', 'rp_user_id', 'rp_user_name', 'location'] # Expected output type: is number, this will be checked. return
20250129013724
247
How many tweets were posted in 2018?
062_Trump
dev
number
['date']
dev
# Instructions: Generate ONLY python code. Do not include explanations. # you can use pandas and numpy. Use the meta data information from df_schema, df_descprtion. import pandas as pd import numpy as np # Description of dataframe schema. df_schema = { "columns": [ { "name": "id", "type": "int64" }, { "name": "author_id", "type": "uint32" }, { "name": "author_name", "type": "category" }, { "name": "author_handler", "type": "category" }, { "name": "author_avatar", "type": "category" }, { "name": "lang", "type": "category" }, { "name": "text", "type": "object" }, { "name": "date", "type": "datetime64[ns, UTC]" }, { "name": "mention_ids", "type": "object" }, { "name": "mention_names", "type": "object" }, { "name": "retweets", "type": "uint32" }, { "name": "favorites", "type": "uint32" }, { "name": "links", "type": "object" }, { "name": "links_first", "type": "category" }, { "name": "image_links", "type": "object" }, { "name": "image_links_first", "type": "category" }, { "name": "tweet_link", "type": "category" }, { "name": "rp_user_id", "type": "float64" }, { "name": "rp_user_name", "type": "category" }, { "name": "location", "type": "category" } ] } # Description of dataframe columns. df_descrption = { "count":{ "id":15039.0, "author_id":15039.0, "retweets":15039.0, "favorites":15039.0, "rp_user_id":38.0 }, "mean":{ "id":7.708974475e+17, "author_id":25073877.0, "retweets":8774.5204468382, "favorites":34438.8956712547, "rp_user_id":409658793.0 }, "std":{ "id":1.524628348e+17, "author_id":0.0, "retweets":11471.4259073933, "favorites":43738.3620217327, "rp_user_id":973036746.0114293098 }, "min":{ "id":5.755855984e+17, "author_id":25073877.0, "retweets":1.0, "favorites":1.0, "rp_user_id":1457641.0 }, "25%":{ "id":6.452230056e+17, "author_id":25073877.0, "retweets":702.5, "favorites":1522.0, "rp_user_id":25073877.0 }, "50%":{ "id":7.232668993e+17, "author_id":25073877.0, "retweets":4216.0, "favorites":11854.0, "rp_user_id":25073877.0 }, "75%":{ "id":9.053052425e+17, "author_id":25073877.0, "retweets":14414.5, "favorites":63094.5, "rp_user_id":99623321.25 }, "max":{ "id":1.075621116e+18, "author_id":25073877.0, "retweets":334538.0, "favorites":589793.0, "rp_user_id":3412873425.0 } } # Randome sample of 10 rows from the dataframe. df_random_sample = { "count":{ "id":15039.0, "author_id":15039.0, "retweets":15039.0, "favorites":15039.0, "rp_user_id":38.0 }, "mean":{ "id":7.708974475e+17, "author_id":25073877.0, "retweets":8774.5204468382, "favorites":34438.8956712547, "rp_user_id":409658793.0 }, "std":{ "id":1.524628348e+17, "author_id":0.0, "retweets":11471.4259073933, "favorites":43738.3620217327, "rp_user_id":973036746.0114293098 }, "min":{ "id":5.755855984e+17, "author_id":25073877.0, "retweets":1.0, "favorites":1.0, "rp_user_id":1457641.0 }, "25%":{ "id":6.452230056e+17, "author_id":25073877.0, "retweets":702.5, "favorites":1522.0, "rp_user_id":25073877.0 }, "50%":{ "id":7.232668993e+17, "author_id":25073877.0, "retweets":4216.0, "favorites":11854.0, "rp_user_id":25073877.0 }, "75%":{ "id":9.053052425e+17, "author_id":25073877.0, "retweets":14414.5, "favorites":63094.5, "rp_user_id":99623321.25 }, "max":{ "id":1.075621116e+18, "author_id":25073877.0, "retweets":334538.0, "favorites":589793.0, "rp_user_id":3412873425.0 } } ''' The question categories are: - boolean: Valid answers include True/False, Y/N, Yes/No (all case insensitive). - category: A value from a cell (or a substring of a cell) in the dataset. - number: A numerical value from a cell in the dataset, which may represent a computed statistic (e.g., average, maximum, minimum). - list[category]: A list containing a fixed number of categories. The expected format is: "['cat', 'dog']". Pay attention to the wording of the question to determine if uniqueness is required or if repeated values are allowed. - list[number]: Similar to list[category], but with numbers as its elements. ''' # TODO: complete the following function in one line, by completing the return statement. It should give the answer to: How many rows are there in this dataframe? def example(df: pd.DataFrame): df.columns=["A"] # Expected output type: is number, this will be checked. return df.shape[0] # It should give the answer to: How many tweets were posted in 2018? # The answer should only contain python code, you are not allowed leave any TODO undone. def answer(df: pd.DataFrame): # Use df to answer: How many tweets were posted in 2018? df.columns = ['id', 'author_id', 'author_name', 'author_handler', 'author_avatar', 'lang', 'text', 'date', 'mention_ids', 'mention_names', 'retweets', 'favorites', 'links', 'links_first', 'image_links', 'image_links_first', 'tweet_link', 'rp_user_id', 'rp_user_name', 'location'] # Expected output type: is number, this will be checked. return
20250129013724
248
What is the most common author name?
062_Trump
dev
category
['author_name']
dev
# Instructions: Generate ONLY python code. Do not include explanations. # you can use pandas and numpy. Use the meta data information from df_schema, df_descprtion. import pandas as pd import numpy as np # Description of dataframe schema. df_schema = { "columns": [ { "name": "id", "type": "int64" }, { "name": "author_id", "type": "uint32" }, { "name": "author_name", "type": "category" }, { "name": "author_handler", "type": "category" }, { "name": "author_avatar", "type": "category" }, { "name": "lang", "type": "category" }, { "name": "text", "type": "object" }, { "name": "date", "type": "datetime64[ns, UTC]" }, { "name": "mention_ids", "type": "object" }, { "name": "mention_names", "type": "object" }, { "name": "retweets", "type": "uint32" }, { "name": "favorites", "type": "uint32" }, { "name": "links", "type": "object" }, { "name": "links_first", "type": "category" }, { "name": "image_links", "type": "object" }, { "name": "image_links_first", "type": "category" }, { "name": "tweet_link", "type": "category" }, { "name": "rp_user_id", "type": "float64" }, { "name": "rp_user_name", "type": "category" }, { "name": "location", "type": "category" } ] } # Description of dataframe columns. df_descrption = { "count":{ "id":15039.0, "author_id":15039.0, "retweets":15039.0, "favorites":15039.0, "rp_user_id":38.0 }, "mean":{ "id":7.708974475e+17, "author_id":25073877.0, "retweets":8774.5204468382, "favorites":34438.8956712547, "rp_user_id":409658793.0 }, "std":{ "id":1.524628348e+17, "author_id":0.0, "retweets":11471.4259073933, "favorites":43738.3620217327, "rp_user_id":973036746.0114293098 }, "min":{ "id":5.755855984e+17, "author_id":25073877.0, "retweets":1.0, "favorites":1.0, "rp_user_id":1457641.0 }, "25%":{ "id":6.452230056e+17, "author_id":25073877.0, "retweets":702.5, "favorites":1522.0, "rp_user_id":25073877.0 }, "50%":{ "id":7.232668993e+17, "author_id":25073877.0, "retweets":4216.0, "favorites":11854.0, "rp_user_id":25073877.0 }, "75%":{ "id":9.053052425e+17, "author_id":25073877.0, "retweets":14414.5, "favorites":63094.5, "rp_user_id":99623321.25 }, "max":{ "id":1.075621116e+18, "author_id":25073877.0, "retweets":334538.0, "favorites":589793.0, "rp_user_id":3412873425.0 } } # Randome sample of 10 rows from the dataframe. df_random_sample = { "count":{ "id":15039.0, "author_id":15039.0, "retweets":15039.0, "favorites":15039.0, "rp_user_id":38.0 }, "mean":{ "id":7.708974475e+17, "author_id":25073877.0, "retweets":8774.5204468382, "favorites":34438.8956712547, "rp_user_id":409658793.0 }, "std":{ "id":1.524628348e+17, "author_id":0.0, "retweets":11471.4259073933, "favorites":43738.3620217327, "rp_user_id":973036746.0114293098 }, "min":{ "id":5.755855984e+17, "author_id":25073877.0, "retweets":1.0, "favorites":1.0, "rp_user_id":1457641.0 }, "25%":{ "id":6.452230056e+17, "author_id":25073877.0, "retweets":702.5, "favorites":1522.0, "rp_user_id":25073877.0 }, "50%":{ "id":7.232668993e+17, "author_id":25073877.0, "retweets":4216.0, "favorites":11854.0, "rp_user_id":25073877.0 }, "75%":{ "id":9.053052425e+17, "author_id":25073877.0, "retweets":14414.5, "favorites":63094.5, "rp_user_id":99623321.25 }, "max":{ "id":1.075621116e+18, "author_id":25073877.0, "retweets":334538.0, "favorites":589793.0, "rp_user_id":3412873425.0 } } ''' The question categories are: - boolean: Valid answers include True/False, Y/N, Yes/No (all case insensitive). - category: A value from a cell (or a substring of a cell) in the dataset. - number: A numerical value from a cell in the dataset, which may represent a computed statistic (e.g., average, maximum, minimum). - list[category]: A list containing a fixed number of categories. The expected format is: "['cat', 'dog']". Pay attention to the wording of the question to determine if uniqueness is required or if repeated values are allowed. - list[number]: Similar to list[category], but with numbers as its elements. ''' # TODO: complete the following function in one line, by completing the return statement. It should give the answer to: How many rows are there in this dataframe? def example(df: pd.DataFrame): df.columns=["A"] # Expected output type: is number, this will be checked. return df.shape[0] # It should give the answer to: What is the most common author name? # The answer should only contain python code, you are not allowed leave any TODO undone. def answer(df: pd.DataFrame): # Use df to answer: What is the most common author name? df.columns = ['id', 'author_id', 'author_name', 'author_handler', 'author_avatar', 'lang', 'text', 'date', 'mention_ids', 'mention_names', 'retweets', 'favorites', 'links', 'links_first', 'image_links', 'image_links_first', 'tweet_link', 'rp_user_id', 'rp_user_name', 'location'] # Expected output type: is category, this will be checked. return
20250129013724
249
What is the tweet with the most favorites?
062_Trump
dev
category
['text', 'favorites']
dev
# Instructions: Generate ONLY python code. Do not include explanations. # you can use pandas and numpy. Use the meta data information from df_schema, df_descprtion. import pandas as pd import numpy as np # Description of dataframe schema. df_schema = { "columns": [ { "name": "id", "type": "int64" }, { "name": "author_id", "type": "uint32" }, { "name": "author_name", "type": "category" }, { "name": "author_handler", "type": "category" }, { "name": "author_avatar", "type": "category" }, { "name": "lang", "type": "category" }, { "name": "text", "type": "object" }, { "name": "date", "type": "datetime64[ns, UTC]" }, { "name": "mention_ids", "type": "object" }, { "name": "mention_names", "type": "object" }, { "name": "retweets", "type": "uint32" }, { "name": "favorites", "type": "uint32" }, { "name": "links", "type": "object" }, { "name": "links_first", "type": "category" }, { "name": "image_links", "type": "object" }, { "name": "image_links_first", "type": "category" }, { "name": "tweet_link", "type": "category" }, { "name": "rp_user_id", "type": "float64" }, { "name": "rp_user_name", "type": "category" }, { "name": "location", "type": "category" } ] } # Description of dataframe columns. df_descrption = { "count":{ "id":15039.0, "author_id":15039.0, "retweets":15039.0, "favorites":15039.0, "rp_user_id":38.0 }, "mean":{ "id":7.708974475e+17, "author_id":25073877.0, "retweets":8774.5204468382, "favorites":34438.8956712547, "rp_user_id":409658793.0 }, "std":{ "id":1.524628348e+17, "author_id":0.0, "retweets":11471.4259073933, "favorites":43738.3620217327, "rp_user_id":973036746.0114293098 }, "min":{ "id":5.755855984e+17, "author_id":25073877.0, "retweets":1.0, "favorites":1.0, "rp_user_id":1457641.0 }, "25%":{ "id":6.452230056e+17, "author_id":25073877.0, "retweets":702.5, "favorites":1522.0, "rp_user_id":25073877.0 }, "50%":{ "id":7.232668993e+17, "author_id":25073877.0, "retweets":4216.0, "favorites":11854.0, "rp_user_id":25073877.0 }, "75%":{ "id":9.053052425e+17, "author_id":25073877.0, "retweets":14414.5, "favorites":63094.5, "rp_user_id":99623321.25 }, "max":{ "id":1.075621116e+18, "author_id":25073877.0, "retweets":334538.0, "favorites":589793.0, "rp_user_id":3412873425.0 } } # Randome sample of 10 rows from the dataframe. df_random_sample = { "count":{ "id":15039.0, "author_id":15039.0, "retweets":15039.0, "favorites":15039.0, "rp_user_id":38.0 }, "mean":{ "id":7.708974475e+17, "author_id":25073877.0, "retweets":8774.5204468382, "favorites":34438.8956712547, "rp_user_id":409658793.0 }, "std":{ "id":1.524628348e+17, "author_id":0.0, "retweets":11471.4259073933, "favorites":43738.3620217327, "rp_user_id":973036746.0114293098 }, "min":{ "id":5.755855984e+17, "author_id":25073877.0, "retweets":1.0, "favorites":1.0, "rp_user_id":1457641.0 }, "25%":{ "id":6.452230056e+17, "author_id":25073877.0, "retweets":702.5, "favorites":1522.0, "rp_user_id":25073877.0 }, "50%":{ "id":7.232668993e+17, "author_id":25073877.0, "retweets":4216.0, "favorites":11854.0, "rp_user_id":25073877.0 }, "75%":{ "id":9.053052425e+17, "author_id":25073877.0, "retweets":14414.5, "favorites":63094.5, "rp_user_id":99623321.25 }, "max":{ "id":1.075621116e+18, "author_id":25073877.0, "retweets":334538.0, "favorites":589793.0, "rp_user_id":3412873425.0 } } ''' The question categories are: - boolean: Valid answers include True/False, Y/N, Yes/No (all case insensitive). - category: A value from a cell (or a substring of a cell) in the dataset. - number: A numerical value from a cell in the dataset, which may represent a computed statistic (e.g., average, maximum, minimum). - list[category]: A list containing a fixed number of categories. The expected format is: "['cat', 'dog']". Pay attention to the wording of the question to determine if uniqueness is required or if repeated values are allowed. - list[number]: Similar to list[category], but with numbers as its elements. ''' # TODO: complete the following function in one line, by completing the return statement. It should give the answer to: How many rows are there in this dataframe? def example(df: pd.DataFrame): df.columns=["A"] # Expected output type: is number, this will be checked. return df.shape[0] # It should give the answer to: What is the tweet with the most favorites? # The answer should only contain python code, you are not allowed leave any TODO undone. def answer(df: pd.DataFrame): # Use df to answer: What is the tweet with the most favorites? df.columns = ['id', 'author_id', 'author_name', 'author_handler', 'author_avatar', 'lang', 'text', 'date', 'mention_ids', 'mention_names', 'retweets', 'favorites', 'links', 'links_first', 'image_links', 'image_links_first', 'tweet_link', 'rp_user_id', 'rp_user_name', 'location'] # Expected output type: is category, this will be checked. return
20250129013724
250
In which language is the tweet with the most retweets written?
062_Trump
dev
category
['lang', 'retweets']
dev
# Instructions: Generate ONLY python code. Do not include explanations. # you can use pandas and numpy. Use the meta data information from df_schema, df_descprtion. import pandas as pd import numpy as np # Description of dataframe schema. df_schema = { "columns": [ { "name": "id", "type": "int64" }, { "name": "author_id", "type": "uint32" }, { "name": "author_name", "type": "category" }, { "name": "author_handler", "type": "category" }, { "name": "author_avatar", "type": "category" }, { "name": "lang", "type": "category" }, { "name": "text", "type": "object" }, { "name": "date", "type": "datetime64[ns, UTC]" }, { "name": "mention_ids", "type": "object" }, { "name": "mention_names", "type": "object" }, { "name": "retweets", "type": "uint32" }, { "name": "favorites", "type": "uint32" }, { "name": "links", "type": "object" }, { "name": "links_first", "type": "category" }, { "name": "image_links", "type": "object" }, { "name": "image_links_first", "type": "category" }, { "name": "tweet_link", "type": "category" }, { "name": "rp_user_id", "type": "float64" }, { "name": "rp_user_name", "type": "category" }, { "name": "location", "type": "category" } ] } # Description of dataframe columns. df_descrption = { "count":{ "id":15039.0, "author_id":15039.0, "retweets":15039.0, "favorites":15039.0, "rp_user_id":38.0 }, "mean":{ "id":7.708974475e+17, "author_id":25073877.0, "retweets":8774.5204468382, "favorites":34438.8956712547, "rp_user_id":409658793.0 }, "std":{ "id":1.524628348e+17, "author_id":0.0, "retweets":11471.4259073933, "favorites":43738.3620217327, "rp_user_id":973036746.0114293098 }, "min":{ "id":5.755855984e+17, "author_id":25073877.0, "retweets":1.0, "favorites":1.0, "rp_user_id":1457641.0 }, "25%":{ "id":6.452230056e+17, "author_id":25073877.0, "retweets":702.5, "favorites":1522.0, "rp_user_id":25073877.0 }, "50%":{ "id":7.232668993e+17, "author_id":25073877.0, "retweets":4216.0, "favorites":11854.0, "rp_user_id":25073877.0 }, "75%":{ "id":9.053052425e+17, "author_id":25073877.0, "retweets":14414.5, "favorites":63094.5, "rp_user_id":99623321.25 }, "max":{ "id":1.075621116e+18, "author_id":25073877.0, "retweets":334538.0, "favorites":589793.0, "rp_user_id":3412873425.0 } } # Randome sample of 10 rows from the dataframe. df_random_sample = { "count":{ "id":15039.0, "author_id":15039.0, "retweets":15039.0, "favorites":15039.0, "rp_user_id":38.0 }, "mean":{ "id":7.708974475e+17, "author_id":25073877.0, "retweets":8774.5204468382, "favorites":34438.8956712547, "rp_user_id":409658793.0 }, "std":{ "id":1.524628348e+17, "author_id":0.0, "retweets":11471.4259073933, "favorites":43738.3620217327, "rp_user_id":973036746.0114293098 }, "min":{ "id":5.755855984e+17, "author_id":25073877.0, "retweets":1.0, "favorites":1.0, "rp_user_id":1457641.0 }, "25%":{ "id":6.452230056e+17, "author_id":25073877.0, "retweets":702.5, "favorites":1522.0, "rp_user_id":25073877.0 }, "50%":{ "id":7.232668993e+17, "author_id":25073877.0, "retweets":4216.0, "favorites":11854.0, "rp_user_id":25073877.0 }, "75%":{ "id":9.053052425e+17, "author_id":25073877.0, "retweets":14414.5, "favorites":63094.5, "rp_user_id":99623321.25 }, "max":{ "id":1.075621116e+18, "author_id":25073877.0, "retweets":334538.0, "favorites":589793.0, "rp_user_id":3412873425.0 } } ''' The question categories are: - boolean: Valid answers include True/False, Y/N, Yes/No (all case insensitive). - category: A value from a cell (or a substring of a cell) in the dataset. - number: A numerical value from a cell in the dataset, which may represent a computed statistic (e.g., average, maximum, minimum). - list[category]: A list containing a fixed number of categories. The expected format is: "['cat', 'dog']". Pay attention to the wording of the question to determine if uniqueness is required or if repeated values are allowed. - list[number]: Similar to list[category], but with numbers as its elements. ''' # TODO: complete the following function in one line, by completing the return statement. It should give the answer to: How many rows are there in this dataframe? def example(df: pd.DataFrame): df.columns=["A"] # Expected output type: is number, this will be checked. return df.shape[0] # It should give the answer to: In which language is the tweet with the most retweets written? # The answer should only contain python code, you are not allowed leave any TODO undone. def answer(df: pd.DataFrame): # Use df to answer: In which language is the tweet with the most retweets written? df.columns = ['id', 'author_id', 'author_name', 'author_handler', 'author_avatar', 'lang', 'text', 'date', 'mention_ids', 'mention_names', 'retweets', 'favorites', 'links', 'links_first', 'image_links', 'image_links_first', 'tweet_link', 'rp_user_id', 'rp_user_name', 'location'] # Expected output type: is category, this will be checked. return
20250129013724
251
What is the most common language of the tweets?
062_Trump
dev
category
['lang']
dev
# Instructions: Generate ONLY python code. Do not include explanations. # you can use pandas and numpy. Use the meta data information from df_schema, df_descprtion. import pandas as pd import numpy as np # Description of dataframe schema. df_schema = { "columns": [ { "name": "id", "type": "int64" }, { "name": "author_id", "type": "uint32" }, { "name": "author_name", "type": "category" }, { "name": "author_handler", "type": "category" }, { "name": "author_avatar", "type": "category" }, { "name": "lang", "type": "category" }, { "name": "text", "type": "object" }, { "name": "date", "type": "datetime64[ns, UTC]" }, { "name": "mention_ids", "type": "object" }, { "name": "mention_names", "type": "object" }, { "name": "retweets", "type": "uint32" }, { "name": "favorites", "type": "uint32" }, { "name": "links", "type": "object" }, { "name": "links_first", "type": "category" }, { "name": "image_links", "type": "object" }, { "name": "image_links_first", "type": "category" }, { "name": "tweet_link", "type": "category" }, { "name": "rp_user_id", "type": "float64" }, { "name": "rp_user_name", "type": "category" }, { "name": "location", "type": "category" } ] } # Description of dataframe columns. df_descrption = { "count":{ "id":15039.0, "author_id":15039.0, "retweets":15039.0, "favorites":15039.0, "rp_user_id":38.0 }, "mean":{ "id":7.708974475e+17, "author_id":25073877.0, "retweets":8774.5204468382, "favorites":34438.8956712547, "rp_user_id":409658793.0 }, "std":{ "id":1.524628348e+17, "author_id":0.0, "retweets":11471.4259073933, "favorites":43738.3620217327, "rp_user_id":973036746.0114293098 }, "min":{ "id":5.755855984e+17, "author_id":25073877.0, "retweets":1.0, "favorites":1.0, "rp_user_id":1457641.0 }, "25%":{ "id":6.452230056e+17, "author_id":25073877.0, "retweets":702.5, "favorites":1522.0, "rp_user_id":25073877.0 }, "50%":{ "id":7.232668993e+17, "author_id":25073877.0, "retweets":4216.0, "favorites":11854.0, "rp_user_id":25073877.0 }, "75%":{ "id":9.053052425e+17, "author_id":25073877.0, "retweets":14414.5, "favorites":63094.5, "rp_user_id":99623321.25 }, "max":{ "id":1.075621116e+18, "author_id":25073877.0, "retweets":334538.0, "favorites":589793.0, "rp_user_id":3412873425.0 } } # Randome sample of 10 rows from the dataframe. df_random_sample = { "count":{ "id":15039.0, "author_id":15039.0, "retweets":15039.0, "favorites":15039.0, "rp_user_id":38.0 }, "mean":{ "id":7.708974475e+17, "author_id":25073877.0, "retweets":8774.5204468382, "favorites":34438.8956712547, "rp_user_id":409658793.0 }, "std":{ "id":1.524628348e+17, "author_id":0.0, "retweets":11471.4259073933, "favorites":43738.3620217327, "rp_user_id":973036746.0114293098 }, "min":{ "id":5.755855984e+17, "author_id":25073877.0, "retweets":1.0, "favorites":1.0, "rp_user_id":1457641.0 }, "25%":{ "id":6.452230056e+17, "author_id":25073877.0, "retweets":702.5, "favorites":1522.0, "rp_user_id":25073877.0 }, "50%":{ "id":7.232668993e+17, "author_id":25073877.0, "retweets":4216.0, "favorites":11854.0, "rp_user_id":25073877.0 }, "75%":{ "id":9.053052425e+17, "author_id":25073877.0, "retweets":14414.5, "favorites":63094.5, "rp_user_id":99623321.25 }, "max":{ "id":1.075621116e+18, "author_id":25073877.0, "retweets":334538.0, "favorites":589793.0, "rp_user_id":3412873425.0 } } ''' The question categories are: - boolean: Valid answers include True/False, Y/N, Yes/No (all case insensitive). - category: A value from a cell (or a substring of a cell) in the dataset. - number: A numerical value from a cell in the dataset, which may represent a computed statistic (e.g., average, maximum, minimum). - list[category]: A list containing a fixed number of categories. The expected format is: "['cat', 'dog']". Pay attention to the wording of the question to determine if uniqueness is required or if repeated values are allowed. - list[number]: Similar to list[category], but with numbers as its elements. ''' # TODO: complete the following function in one line, by completing the return statement. It should give the answer to: How many rows are there in this dataframe? def example(df: pd.DataFrame): df.columns=["A"] # Expected output type: is number, this will be checked. return df.shape[0] # It should give the answer to: What is the most common language of the tweets? # The answer should only contain python code, you are not allowed leave any TODO undone. def answer(df: pd.DataFrame): # Use df to answer: What is the most common language of the tweets? df.columns = ['id', 'author_id', 'author_name', 'author_handler', 'author_avatar', 'lang', 'text', 'date', 'mention_ids', 'mention_names', 'retweets', 'favorites', 'links', 'links_first', 'image_links', 'image_links_first', 'tweet_link', 'rp_user_id', 'rp_user_name', 'location'] # Expected output type: is category, this will be checked. return
20250129013724
252
What are the top 3 author handlers with the most tweets?
062_Trump
dev
list[category]
['author_handler']
dev
# Instructions: Generate ONLY python code. Do not include explanations. # you can use pandas and numpy. Use the meta data information from df_schema, df_descprtion. import pandas as pd import numpy as np # Description of dataframe schema. df_schema = { "columns": [ { "name": "id", "type": "int64" }, { "name": "author_id", "type": "uint32" }, { "name": "author_name", "type": "category" }, { "name": "author_handler", "type": "category" }, { "name": "author_avatar", "type": "category" }, { "name": "lang", "type": "category" }, { "name": "text", "type": "object" }, { "name": "date", "type": "datetime64[ns, UTC]" }, { "name": "mention_ids", "type": "object" }, { "name": "mention_names", "type": "object" }, { "name": "retweets", "type": "uint32" }, { "name": "favorites", "type": "uint32" }, { "name": "links", "type": "object" }, { "name": "links_first", "type": "category" }, { "name": "image_links", "type": "object" }, { "name": "image_links_first", "type": "category" }, { "name": "tweet_link", "type": "category" }, { "name": "rp_user_id", "type": "float64" }, { "name": "rp_user_name", "type": "category" }, { "name": "location", "type": "category" } ] } # Description of dataframe columns. df_descrption = { "count":{ "id":15039.0, "author_id":15039.0, "retweets":15039.0, "favorites":15039.0, "rp_user_id":38.0 }, "mean":{ "id":7.708974475e+17, "author_id":25073877.0, "retweets":8774.5204468382, "favorites":34438.8956712547, "rp_user_id":409658793.0 }, "std":{ "id":1.524628348e+17, "author_id":0.0, "retweets":11471.4259073933, "favorites":43738.3620217327, "rp_user_id":973036746.0114293098 }, "min":{ "id":5.755855984e+17, "author_id":25073877.0, "retweets":1.0, "favorites":1.0, "rp_user_id":1457641.0 }, "25%":{ "id":6.452230056e+17, "author_id":25073877.0, "retweets":702.5, "favorites":1522.0, "rp_user_id":25073877.0 }, "50%":{ "id":7.232668993e+17, "author_id":25073877.0, "retweets":4216.0, "favorites":11854.0, "rp_user_id":25073877.0 }, "75%":{ "id":9.053052425e+17, "author_id":25073877.0, "retweets":14414.5, "favorites":63094.5, "rp_user_id":99623321.25 }, "max":{ "id":1.075621116e+18, "author_id":25073877.0, "retweets":334538.0, "favorites":589793.0, "rp_user_id":3412873425.0 } } # Randome sample of 10 rows from the dataframe. df_random_sample = { "count":{ "id":15039.0, "author_id":15039.0, "retweets":15039.0, "favorites":15039.0, "rp_user_id":38.0 }, "mean":{ "id":7.708974475e+17, "author_id":25073877.0, "retweets":8774.5204468382, "favorites":34438.8956712547, "rp_user_id":409658793.0 }, "std":{ "id":1.524628348e+17, "author_id":0.0, "retweets":11471.4259073933, "favorites":43738.3620217327, "rp_user_id":973036746.0114293098 }, "min":{ "id":5.755855984e+17, "author_id":25073877.0, "retweets":1.0, "favorites":1.0, "rp_user_id":1457641.0 }, "25%":{ "id":6.452230056e+17, "author_id":25073877.0, "retweets":702.5, "favorites":1522.0, "rp_user_id":25073877.0 }, "50%":{ "id":7.232668993e+17, "author_id":25073877.0, "retweets":4216.0, "favorites":11854.0, "rp_user_id":25073877.0 }, "75%":{ "id":9.053052425e+17, "author_id":25073877.0, "retweets":14414.5, "favorites":63094.5, "rp_user_id":99623321.25 }, "max":{ "id":1.075621116e+18, "author_id":25073877.0, "retweets":334538.0, "favorites":589793.0, "rp_user_id":3412873425.0 } } ''' The question categories are: - boolean: Valid answers include True/False, Y/N, Yes/No (all case insensitive). - category: A value from a cell (or a substring of a cell) in the dataset. - number: A numerical value from a cell in the dataset, which may represent a computed statistic (e.g., average, maximum, minimum). - list[category]: A list containing a fixed number of categories. The expected format is: "['cat', 'dog']". Pay attention to the wording of the question to determine if uniqueness is required or if repeated values are allowed. - list[number]: Similar to list[category], but with numbers as its elements. ''' # TODO: complete the following function in one line, by completing the return statement. It should give the answer to: How many rows are there in this dataframe? def example(df: pd.DataFrame): df.columns=["A"] # Expected output type: is number, this will be checked. return df.shape[0] # It should give the answer to: What are the top 3 author handlers with the most tweets? # The answer should only contain python code, you are not allowed leave any TODO undone. def answer(df: pd.DataFrame): # Use df to answer: What are the top 3 author handlers with the most tweets? df.columns = ['id', 'author_id', 'author_name', 'author_handler', 'author_avatar', 'lang', 'text', 'date', 'mention_ids', 'mention_names', 'retweets', 'favorites', 'links', 'links_first', 'image_links', 'image_links_first', 'tweet_link', 'rp_user_id', 'rp_user_name', 'location'] # Expected output type: is list[category], this will be checked. return
20250129013724
253
What are the bottom 2 languages in terms of tweet count? If there are more than two give priority to those starting with the letter p
062_Trump
dev
list[category]
['lang']
dev
# Instructions: Generate ONLY python code. Do not include explanations. # you can use pandas and numpy. Use the meta data information from df_schema, df_descprtion. import pandas as pd import numpy as np # Description of dataframe schema. df_schema = { "columns": [ { "name": "id", "type": "int64" }, { "name": "author_id", "type": "uint32" }, { "name": "author_name", "type": "category" }, { "name": "author_handler", "type": "category" }, { "name": "author_avatar", "type": "category" }, { "name": "lang", "type": "category" }, { "name": "text", "type": "object" }, { "name": "date", "type": "datetime64[ns, UTC]" }, { "name": "mention_ids", "type": "object" }, { "name": "mention_names", "type": "object" }, { "name": "retweets", "type": "uint32" }, { "name": "favorites", "type": "uint32" }, { "name": "links", "type": "object" }, { "name": "links_first", "type": "category" }, { "name": "image_links", "type": "object" }, { "name": "image_links_first", "type": "category" }, { "name": "tweet_link", "type": "category" }, { "name": "rp_user_id", "type": "float64" }, { "name": "rp_user_name", "type": "category" }, { "name": "location", "type": "category" } ] } # Description of dataframe columns. df_descrption = { "count":{ "id":15039.0, "author_id":15039.0, "retweets":15039.0, "favorites":15039.0, "rp_user_id":38.0 }, "mean":{ "id":7.708974475e+17, "author_id":25073877.0, "retweets":8774.5204468382, "favorites":34438.8956712547, "rp_user_id":409658793.0 }, "std":{ "id":1.524628348e+17, "author_id":0.0, "retweets":11471.4259073933, "favorites":43738.3620217327, "rp_user_id":973036746.0114293098 }, "min":{ "id":5.755855984e+17, "author_id":25073877.0, "retweets":1.0, "favorites":1.0, "rp_user_id":1457641.0 }, "25%":{ "id":6.452230056e+17, "author_id":25073877.0, "retweets":702.5, "favorites":1522.0, "rp_user_id":25073877.0 }, "50%":{ "id":7.232668993e+17, "author_id":25073877.0, "retweets":4216.0, "favorites":11854.0, "rp_user_id":25073877.0 }, "75%":{ "id":9.053052425e+17, "author_id":25073877.0, "retweets":14414.5, "favorites":63094.5, "rp_user_id":99623321.25 }, "max":{ "id":1.075621116e+18, "author_id":25073877.0, "retweets":334538.0, "favorites":589793.0, "rp_user_id":3412873425.0 } } # Randome sample of 10 rows from the dataframe. df_random_sample = { "count":{ "id":15039.0, "author_id":15039.0, "retweets":15039.0, "favorites":15039.0, "rp_user_id":38.0 }, "mean":{ "id":7.708974475e+17, "author_id":25073877.0, "retweets":8774.5204468382, "favorites":34438.8956712547, "rp_user_id":409658793.0 }, "std":{ "id":1.524628348e+17, "author_id":0.0, "retweets":11471.4259073933, "favorites":43738.3620217327, "rp_user_id":973036746.0114293098 }, "min":{ "id":5.755855984e+17, "author_id":25073877.0, "retweets":1.0, "favorites":1.0, "rp_user_id":1457641.0 }, "25%":{ "id":6.452230056e+17, "author_id":25073877.0, "retweets":702.5, "favorites":1522.0, "rp_user_id":25073877.0 }, "50%":{ "id":7.232668993e+17, "author_id":25073877.0, "retweets":4216.0, "favorites":11854.0, "rp_user_id":25073877.0 }, "75%":{ "id":9.053052425e+17, "author_id":25073877.0, "retweets":14414.5, "favorites":63094.5, "rp_user_id":99623321.25 }, "max":{ "id":1.075621116e+18, "author_id":25073877.0, "retweets":334538.0, "favorites":589793.0, "rp_user_id":3412873425.0 } } ''' The question categories are: - boolean: Valid answers include True/False, Y/N, Yes/No (all case insensitive). - category: A value from a cell (or a substring of a cell) in the dataset. - number: A numerical value from a cell in the dataset, which may represent a computed statistic (e.g., average, maximum, minimum). - list[category]: A list containing a fixed number of categories. The expected format is: "['cat', 'dog']". Pay attention to the wording of the question to determine if uniqueness is required or if repeated values are allowed. - list[number]: Similar to list[category], but with numbers as its elements. ''' # TODO: complete the following function in one line, by completing the return statement. It should give the answer to: How many rows are there in this dataframe? def example(df: pd.DataFrame): df.columns=["A"] # Expected output type: is number, this will be checked. return df.shape[0] # It should give the answer to: What are the bottom 2 languages in terms of tweet count? If there are more than two give priority to those starting with the letter p # The answer should only contain python code, you are not allowed leave any TODO undone. def answer(df: pd.DataFrame): # Use df to answer: What are the bottom 2 languages in terms of tweet count? If there are more than two give priority to those starting with the letter p df.columns = ['id', 'author_id', 'author_name', 'author_handler', 'author_avatar', 'lang', 'text', 'date', 'mention_ids', 'mention_names', 'retweets', 'favorites', 'links', 'links_first', 'image_links', 'image_links_first', 'tweet_link', 'rp_user_id', 'rp_user_name', 'location'] # Expected output type: is list[category], this will be checked. return
20250129013724
254
What are the top 4 mentioned names in the tweets?
062_Trump
dev
list[category]
['mention_names']
dev
# Instructions: Generate ONLY python code. Do not include explanations. # you can use pandas and numpy. Use the meta data information from df_schema, df_descprtion. import pandas as pd import numpy as np # Description of dataframe schema. df_schema = { "columns": [ { "name": "id", "type": "int64" }, { "name": "author_id", "type": "uint32" }, { "name": "author_name", "type": "category" }, { "name": "author_handler", "type": "category" }, { "name": "author_avatar", "type": "category" }, { "name": "lang", "type": "category" }, { "name": "text", "type": "object" }, { "name": "date", "type": "datetime64[ns, UTC]" }, { "name": "mention_ids", "type": "object" }, { "name": "mention_names", "type": "object" }, { "name": "retweets", "type": "uint32" }, { "name": "favorites", "type": "uint32" }, { "name": "links", "type": "object" }, { "name": "links_first", "type": "category" }, { "name": "image_links", "type": "object" }, { "name": "image_links_first", "type": "category" }, { "name": "tweet_link", "type": "category" }, { "name": "rp_user_id", "type": "float64" }, { "name": "rp_user_name", "type": "category" }, { "name": "location", "type": "category" } ] } # Description of dataframe columns. df_descrption = { "count":{ "id":15039.0, "author_id":15039.0, "retweets":15039.0, "favorites":15039.0, "rp_user_id":38.0 }, "mean":{ "id":7.708974475e+17, "author_id":25073877.0, "retweets":8774.5204468382, "favorites":34438.8956712547, "rp_user_id":409658793.0 }, "std":{ "id":1.524628348e+17, "author_id":0.0, "retweets":11471.4259073933, "favorites":43738.3620217327, "rp_user_id":973036746.0114293098 }, "min":{ "id":5.755855984e+17, "author_id":25073877.0, "retweets":1.0, "favorites":1.0, "rp_user_id":1457641.0 }, "25%":{ "id":6.452230056e+17, "author_id":25073877.0, "retweets":702.5, "favorites":1522.0, "rp_user_id":25073877.0 }, "50%":{ "id":7.232668993e+17, "author_id":25073877.0, "retweets":4216.0, "favorites":11854.0, "rp_user_id":25073877.0 }, "75%":{ "id":9.053052425e+17, "author_id":25073877.0, "retweets":14414.5, "favorites":63094.5, "rp_user_id":99623321.25 }, "max":{ "id":1.075621116e+18, "author_id":25073877.0, "retweets":334538.0, "favorites":589793.0, "rp_user_id":3412873425.0 } } # Randome sample of 10 rows from the dataframe. df_random_sample = { "count":{ "id":15039.0, "author_id":15039.0, "retweets":15039.0, "favorites":15039.0, "rp_user_id":38.0 }, "mean":{ "id":7.708974475e+17, "author_id":25073877.0, "retweets":8774.5204468382, "favorites":34438.8956712547, "rp_user_id":409658793.0 }, "std":{ "id":1.524628348e+17, "author_id":0.0, "retweets":11471.4259073933, "favorites":43738.3620217327, "rp_user_id":973036746.0114293098 }, "min":{ "id":5.755855984e+17, "author_id":25073877.0, "retweets":1.0, "favorites":1.0, "rp_user_id":1457641.0 }, "25%":{ "id":6.452230056e+17, "author_id":25073877.0, "retweets":702.5, "favorites":1522.0, "rp_user_id":25073877.0 }, "50%":{ "id":7.232668993e+17, "author_id":25073877.0, "retweets":4216.0, "favorites":11854.0, "rp_user_id":25073877.0 }, "75%":{ "id":9.053052425e+17, "author_id":25073877.0, "retweets":14414.5, "favorites":63094.5, "rp_user_id":99623321.25 }, "max":{ "id":1.075621116e+18, "author_id":25073877.0, "retweets":334538.0, "favorites":589793.0, "rp_user_id":3412873425.0 } } ''' The question categories are: - boolean: Valid answers include True/False, Y/N, Yes/No (all case insensitive). - category: A value from a cell (or a substring of a cell) in the dataset. - number: A numerical value from a cell in the dataset, which may represent a computed statistic (e.g., average, maximum, minimum). - list[category]: A list containing a fixed number of categories. The expected format is: "['cat', 'dog']". Pay attention to the wording of the question to determine if uniqueness is required or if repeated values are allowed. - list[number]: Similar to list[category], but with numbers as its elements. ''' # TODO: complete the following function in one line, by completing the return statement. It should give the answer to: How many rows are there in this dataframe? def example(df: pd.DataFrame): df.columns=["A"] # Expected output type: is number, this will be checked. return df.shape[0] # It should give the answer to: What are the top 4 mentioned names in the tweets? # The answer should only contain python code, you are not allowed leave any TODO undone. def answer(df: pd.DataFrame): # Use df to answer: What are the top 4 mentioned names in the tweets? df.columns = ['id', 'author_id', 'author_name', 'author_handler', 'author_avatar', 'lang', 'text', 'date', 'mention_ids', 'mention_names', 'retweets', 'favorites', 'links', 'links_first', 'image_links', 'image_links_first', 'tweet_link', 'rp_user_id', 'rp_user_name', 'location'] # Expected output type: is list[category], this will be checked. return
20250129013724
255
What are the bottom 3 author names in terms of tweet count?
062_Trump
dev
list[category]
['author_name']
dev
# Instructions: Generate ONLY python code. Do not include explanations. # you can use pandas and numpy. Use the meta data information from df_schema, df_descprtion. import pandas as pd import numpy as np # Description of dataframe schema. df_schema = { "columns": [ { "name": "id", "type": "int64" }, { "name": "author_id", "type": "uint32" }, { "name": "author_name", "type": "category" }, { "name": "author_handler", "type": "category" }, { "name": "author_avatar", "type": "category" }, { "name": "lang", "type": "category" }, { "name": "text", "type": "object" }, { "name": "date", "type": "datetime64[ns, UTC]" }, { "name": "mention_ids", "type": "object" }, { "name": "mention_names", "type": "object" }, { "name": "retweets", "type": "uint32" }, { "name": "favorites", "type": "uint32" }, { "name": "links", "type": "object" }, { "name": "links_first", "type": "category" }, { "name": "image_links", "type": "object" }, { "name": "image_links_first", "type": "category" }, { "name": "tweet_link", "type": "category" }, { "name": "rp_user_id", "type": "float64" }, { "name": "rp_user_name", "type": "category" }, { "name": "location", "type": "category" } ] } # Description of dataframe columns. df_descrption = { "count":{ "id":15039.0, "author_id":15039.0, "retweets":15039.0, "favorites":15039.0, "rp_user_id":38.0 }, "mean":{ "id":7.708974475e+17, "author_id":25073877.0, "retweets":8774.5204468382, "favorites":34438.8956712547, "rp_user_id":409658793.0 }, "std":{ "id":1.524628348e+17, "author_id":0.0, "retweets":11471.4259073933, "favorites":43738.3620217327, "rp_user_id":973036746.0114293098 }, "min":{ "id":5.755855984e+17, "author_id":25073877.0, "retweets":1.0, "favorites":1.0, "rp_user_id":1457641.0 }, "25%":{ "id":6.452230056e+17, "author_id":25073877.0, "retweets":702.5, "favorites":1522.0, "rp_user_id":25073877.0 }, "50%":{ "id":7.232668993e+17, "author_id":25073877.0, "retweets":4216.0, "favorites":11854.0, "rp_user_id":25073877.0 }, "75%":{ "id":9.053052425e+17, "author_id":25073877.0, "retweets":14414.5, "favorites":63094.5, "rp_user_id":99623321.25 }, "max":{ "id":1.075621116e+18, "author_id":25073877.0, "retweets":334538.0, "favorites":589793.0, "rp_user_id":3412873425.0 } } # Randome sample of 10 rows from the dataframe. df_random_sample = { "count":{ "id":15039.0, "author_id":15039.0, "retweets":15039.0, "favorites":15039.0, "rp_user_id":38.0 }, "mean":{ "id":7.708974475e+17, "author_id":25073877.0, "retweets":8774.5204468382, "favorites":34438.8956712547, "rp_user_id":409658793.0 }, "std":{ "id":1.524628348e+17, "author_id":0.0, "retweets":11471.4259073933, "favorites":43738.3620217327, "rp_user_id":973036746.0114293098 }, "min":{ "id":5.755855984e+17, "author_id":25073877.0, "retweets":1.0, "favorites":1.0, "rp_user_id":1457641.0 }, "25%":{ "id":6.452230056e+17, "author_id":25073877.0, "retweets":702.5, "favorites":1522.0, "rp_user_id":25073877.0 }, "50%":{ "id":7.232668993e+17, "author_id":25073877.0, "retweets":4216.0, "favorites":11854.0, "rp_user_id":25073877.0 }, "75%":{ "id":9.053052425e+17, "author_id":25073877.0, "retweets":14414.5, "favorites":63094.5, "rp_user_id":99623321.25 }, "max":{ "id":1.075621116e+18, "author_id":25073877.0, "retweets":334538.0, "favorites":589793.0, "rp_user_id":3412873425.0 } } ''' The question categories are: - boolean: Valid answers include True/False, Y/N, Yes/No (all case insensitive). - category: A value from a cell (or a substring of a cell) in the dataset. - number: A numerical value from a cell in the dataset, which may represent a computed statistic (e.g., average, maximum, minimum). - list[category]: A list containing a fixed number of categories. The expected format is: "['cat', 'dog']". Pay attention to the wording of the question to determine if uniqueness is required or if repeated values are allowed. - list[number]: Similar to list[category], but with numbers as its elements. ''' # TODO: complete the following function in one line, by completing the return statement. It should give the answer to: How many rows are there in this dataframe? def example(df: pd.DataFrame): df.columns=["A"] # Expected output type: is number, this will be checked. return df.shape[0] # It should give the answer to: What are the bottom 3 author names in terms of tweet count? # The answer should only contain python code, you are not allowed leave any TODO undone. def answer(df: pd.DataFrame): # Use df to answer: What are the bottom 3 author names in terms of tweet count? df.columns = ['id', 'author_id', 'author_name', 'author_handler', 'author_avatar', 'lang', 'text', 'date', 'mention_ids', 'mention_names', 'retweets', 'favorites', 'links', 'links_first', 'image_links', 'image_links_first', 'tweet_link', 'rp_user_id', 'rp_user_name', 'location'] # Expected output type: is list[category], this will be checked. return
20250129013724
256
What are the top 5 tweet IDs in terms of retweet count?
062_Trump
dev
list[number]
['id', 'retweets']
dev
# Instructions: Generate ONLY python code. Do not include explanations. # you can use pandas and numpy. Use the meta data information from df_schema, df_descprtion. import pandas as pd import numpy as np # Description of dataframe schema. df_schema = { "columns": [ { "name": "id", "type": "int64" }, { "name": "author_id", "type": "uint32" }, { "name": "author_name", "type": "category" }, { "name": "author_handler", "type": "category" }, { "name": "author_avatar", "type": "category" }, { "name": "lang", "type": "category" }, { "name": "text", "type": "object" }, { "name": "date", "type": "datetime64[ns, UTC]" }, { "name": "mention_ids", "type": "object" }, { "name": "mention_names", "type": "object" }, { "name": "retweets", "type": "uint32" }, { "name": "favorites", "type": "uint32" }, { "name": "links", "type": "object" }, { "name": "links_first", "type": "category" }, { "name": "image_links", "type": "object" }, { "name": "image_links_first", "type": "category" }, { "name": "tweet_link", "type": "category" }, { "name": "rp_user_id", "type": "float64" }, { "name": "rp_user_name", "type": "category" }, { "name": "location", "type": "category" } ] } # Description of dataframe columns. df_descrption = { "count":{ "id":15039.0, "author_id":15039.0, "retweets":15039.0, "favorites":15039.0, "rp_user_id":38.0 }, "mean":{ "id":7.708974475e+17, "author_id":25073877.0, "retweets":8774.5204468382, "favorites":34438.8956712547, "rp_user_id":409658793.0 }, "std":{ "id":1.524628348e+17, "author_id":0.0, "retweets":11471.4259073933, "favorites":43738.3620217327, "rp_user_id":973036746.0114293098 }, "min":{ "id":5.755855984e+17, "author_id":25073877.0, "retweets":1.0, "favorites":1.0, "rp_user_id":1457641.0 }, "25%":{ "id":6.452230056e+17, "author_id":25073877.0, "retweets":702.5, "favorites":1522.0, "rp_user_id":25073877.0 }, "50%":{ "id":7.232668993e+17, "author_id":25073877.0, "retweets":4216.0, "favorites":11854.0, "rp_user_id":25073877.0 }, "75%":{ "id":9.053052425e+17, "author_id":25073877.0, "retweets":14414.5, "favorites":63094.5, "rp_user_id":99623321.25 }, "max":{ "id":1.075621116e+18, "author_id":25073877.0, "retweets":334538.0, "favorites":589793.0, "rp_user_id":3412873425.0 } } # Randome sample of 10 rows from the dataframe. df_random_sample = { "count":{ "id":15039.0, "author_id":15039.0, "retweets":15039.0, "favorites":15039.0, "rp_user_id":38.0 }, "mean":{ "id":7.708974475e+17, "author_id":25073877.0, "retweets":8774.5204468382, "favorites":34438.8956712547, "rp_user_id":409658793.0 }, "std":{ "id":1.524628348e+17, "author_id":0.0, "retweets":11471.4259073933, "favorites":43738.3620217327, "rp_user_id":973036746.0114293098 }, "min":{ "id":5.755855984e+17, "author_id":25073877.0, "retweets":1.0, "favorites":1.0, "rp_user_id":1457641.0 }, "25%":{ "id":6.452230056e+17, "author_id":25073877.0, "retweets":702.5, "favorites":1522.0, "rp_user_id":25073877.0 }, "50%":{ "id":7.232668993e+17, "author_id":25073877.0, "retweets":4216.0, "favorites":11854.0, "rp_user_id":25073877.0 }, "75%":{ "id":9.053052425e+17, "author_id":25073877.0, "retweets":14414.5, "favorites":63094.5, "rp_user_id":99623321.25 }, "max":{ "id":1.075621116e+18, "author_id":25073877.0, "retweets":334538.0, "favorites":589793.0, "rp_user_id":3412873425.0 } } ''' The question categories are: - boolean: Valid answers include True/False, Y/N, Yes/No (all case insensitive). - category: A value from a cell (or a substring of a cell) in the dataset. - number: A numerical value from a cell in the dataset, which may represent a computed statistic (e.g., average, maximum, minimum). - list[category]: A list containing a fixed number of categories. The expected format is: "['cat', 'dog']". Pay attention to the wording of the question to determine if uniqueness is required or if repeated values are allowed. - list[number]: Similar to list[category], but with numbers as its elements. ''' # TODO: complete the following function in one line, by completing the return statement. It should give the answer to: How many rows are there in this dataframe? def example(df: pd.DataFrame): df.columns=["A"] # Expected output type: is number, this will be checked. return df.shape[0] # It should give the answer to: What are the top 5 tweet IDs in terms of retweet count? # The answer should only contain python code, you are not allowed leave any TODO undone. def answer(df: pd.DataFrame): # Use df to answer: What are the top 5 tweet IDs in terms of retweet count? df.columns = ['id', 'author_id', 'author_name', 'author_handler', 'author_avatar', 'lang', 'text', 'date', 'mention_ids', 'mention_names', 'retweets', 'favorites', 'links', 'links_first', 'image_links', 'image_links_first', 'tweet_link', 'rp_user_id', 'rp_user_name', 'location'] # Expected output type: is list[number], this will be checked. return
20250129013724
257
What are the bottom 4 tweet IDs in terms of favorite count?
062_Trump
dev
list[number]
['id', 'favorites']
dev
# Instructions: Generate ONLY python code. Do not include explanations. # you can use pandas and numpy. Use the meta data information from df_schema, df_descprtion. import pandas as pd import numpy as np # Description of dataframe schema. df_schema = { "columns": [ { "name": "id", "type": "int64" }, { "name": "author_id", "type": "uint32" }, { "name": "author_name", "type": "category" }, { "name": "author_handler", "type": "category" }, { "name": "author_avatar", "type": "category" }, { "name": "lang", "type": "category" }, { "name": "text", "type": "object" }, { "name": "date", "type": "datetime64[ns, UTC]" }, { "name": "mention_ids", "type": "object" }, { "name": "mention_names", "type": "object" }, { "name": "retweets", "type": "uint32" }, { "name": "favorites", "type": "uint32" }, { "name": "links", "type": "object" }, { "name": "links_first", "type": "category" }, { "name": "image_links", "type": "object" }, { "name": "image_links_first", "type": "category" }, { "name": "tweet_link", "type": "category" }, { "name": "rp_user_id", "type": "float64" }, { "name": "rp_user_name", "type": "category" }, { "name": "location", "type": "category" } ] } # Description of dataframe columns. df_descrption = { "count":{ "id":15039.0, "author_id":15039.0, "retweets":15039.0, "favorites":15039.0, "rp_user_id":38.0 }, "mean":{ "id":7.708974475e+17, "author_id":25073877.0, "retweets":8774.5204468382, "favorites":34438.8956712547, "rp_user_id":409658793.0 }, "std":{ "id":1.524628348e+17, "author_id":0.0, "retweets":11471.4259073933, "favorites":43738.3620217327, "rp_user_id":973036746.0114293098 }, "min":{ "id":5.755855984e+17, "author_id":25073877.0, "retweets":1.0, "favorites":1.0, "rp_user_id":1457641.0 }, "25%":{ "id":6.452230056e+17, "author_id":25073877.0, "retweets":702.5, "favorites":1522.0, "rp_user_id":25073877.0 }, "50%":{ "id":7.232668993e+17, "author_id":25073877.0, "retweets":4216.0, "favorites":11854.0, "rp_user_id":25073877.0 }, "75%":{ "id":9.053052425e+17, "author_id":25073877.0, "retweets":14414.5, "favorites":63094.5, "rp_user_id":99623321.25 }, "max":{ "id":1.075621116e+18, "author_id":25073877.0, "retweets":334538.0, "favorites":589793.0, "rp_user_id":3412873425.0 } } # Randome sample of 10 rows from the dataframe. df_random_sample = { "count":{ "id":15039.0, "author_id":15039.0, "retweets":15039.0, "favorites":15039.0, "rp_user_id":38.0 }, "mean":{ "id":7.708974475e+17, "author_id":25073877.0, "retweets":8774.5204468382, "favorites":34438.8956712547, "rp_user_id":409658793.0 }, "std":{ "id":1.524628348e+17, "author_id":0.0, "retweets":11471.4259073933, "favorites":43738.3620217327, "rp_user_id":973036746.0114293098 }, "min":{ "id":5.755855984e+17, "author_id":25073877.0, "retweets":1.0, "favorites":1.0, "rp_user_id":1457641.0 }, "25%":{ "id":6.452230056e+17, "author_id":25073877.0, "retweets":702.5, "favorites":1522.0, "rp_user_id":25073877.0 }, "50%":{ "id":7.232668993e+17, "author_id":25073877.0, "retweets":4216.0, "favorites":11854.0, "rp_user_id":25073877.0 }, "75%":{ "id":9.053052425e+17, "author_id":25073877.0, "retweets":14414.5, "favorites":63094.5, "rp_user_id":99623321.25 }, "max":{ "id":1.075621116e+18, "author_id":25073877.0, "retweets":334538.0, "favorites":589793.0, "rp_user_id":3412873425.0 } } ''' The question categories are: - boolean: Valid answers include True/False, Y/N, Yes/No (all case insensitive). - category: A value from a cell (or a substring of a cell) in the dataset. - number: A numerical value from a cell in the dataset, which may represent a computed statistic (e.g., average, maximum, minimum). - list[category]: A list containing a fixed number of categories. The expected format is: "['cat', 'dog']". Pay attention to the wording of the question to determine if uniqueness is required or if repeated values are allowed. - list[number]: Similar to list[category], but with numbers as its elements. ''' # TODO: complete the following function in one line, by completing the return statement. It should give the answer to: How many rows are there in this dataframe? def example(df: pd.DataFrame): df.columns=["A"] # Expected output type: is number, this will be checked. return df.shape[0] # It should give the answer to: What are the bottom 4 tweet IDs in terms of favorite count? # The answer should only contain python code, you are not allowed leave any TODO undone. def answer(df: pd.DataFrame): # Use df to answer: What are the bottom 4 tweet IDs in terms of favorite count? df.columns = ['id', 'author_id', 'author_name', 'author_handler', 'author_avatar', 'lang', 'text', 'date', 'mention_ids', 'mention_names', 'retweets', 'favorites', 'links', 'links_first', 'image_links', 'image_links_first', 'tweet_link', 'rp_user_id', 'rp_user_name', 'location'] # Expected output type: is list[number], this will be checked. return
20250129013724
258
What are the top 6 favorite counts of the tweets?
062_Trump
dev
list[number]
['favorites']
dev
# Instructions: Generate ONLY python code. Do not include explanations. # you can use pandas and numpy. Use the meta data information from df_schema, df_descprtion. import pandas as pd import numpy as np # Description of dataframe schema. df_schema = { "columns": [ { "name": "id", "type": "int64" }, { "name": "author_id", "type": "uint32" }, { "name": "author_name", "type": "category" }, { "name": "author_handler", "type": "category" }, { "name": "author_avatar", "type": "category" }, { "name": "lang", "type": "category" }, { "name": "text", "type": "object" }, { "name": "date", "type": "datetime64[ns, UTC]" }, { "name": "mention_ids", "type": "object" }, { "name": "mention_names", "type": "object" }, { "name": "retweets", "type": "uint32" }, { "name": "favorites", "type": "uint32" }, { "name": "links", "type": "object" }, { "name": "links_first", "type": "category" }, { "name": "image_links", "type": "object" }, { "name": "image_links_first", "type": "category" }, { "name": "tweet_link", "type": "category" }, { "name": "rp_user_id", "type": "float64" }, { "name": "rp_user_name", "type": "category" }, { "name": "location", "type": "category" } ] } # Description of dataframe columns. df_descrption = { "count":{ "id":15039.0, "author_id":15039.0, "retweets":15039.0, "favorites":15039.0, "rp_user_id":38.0 }, "mean":{ "id":7.708974475e+17, "author_id":25073877.0, "retweets":8774.5204468382, "favorites":34438.8956712547, "rp_user_id":409658793.0 }, "std":{ "id":1.524628348e+17, "author_id":0.0, "retweets":11471.4259073933, "favorites":43738.3620217327, "rp_user_id":973036746.0114293098 }, "min":{ "id":5.755855984e+17, "author_id":25073877.0, "retweets":1.0, "favorites":1.0, "rp_user_id":1457641.0 }, "25%":{ "id":6.452230056e+17, "author_id":25073877.0, "retweets":702.5, "favorites":1522.0, "rp_user_id":25073877.0 }, "50%":{ "id":7.232668993e+17, "author_id":25073877.0, "retweets":4216.0, "favorites":11854.0, "rp_user_id":25073877.0 }, "75%":{ "id":9.053052425e+17, "author_id":25073877.0, "retweets":14414.5, "favorites":63094.5, "rp_user_id":99623321.25 }, "max":{ "id":1.075621116e+18, "author_id":25073877.0, "retweets":334538.0, "favorites":589793.0, "rp_user_id":3412873425.0 } } # Randome sample of 10 rows from the dataframe. df_random_sample = { "count":{ "id":15039.0, "author_id":15039.0, "retweets":15039.0, "favorites":15039.0, "rp_user_id":38.0 }, "mean":{ "id":7.708974475e+17, "author_id":25073877.0, "retweets":8774.5204468382, "favorites":34438.8956712547, "rp_user_id":409658793.0 }, "std":{ "id":1.524628348e+17, "author_id":0.0, "retweets":11471.4259073933, "favorites":43738.3620217327, "rp_user_id":973036746.0114293098 }, "min":{ "id":5.755855984e+17, "author_id":25073877.0, "retweets":1.0, "favorites":1.0, "rp_user_id":1457641.0 }, "25%":{ "id":6.452230056e+17, "author_id":25073877.0, "retweets":702.5, "favorites":1522.0, "rp_user_id":25073877.0 }, "50%":{ "id":7.232668993e+17, "author_id":25073877.0, "retweets":4216.0, "favorites":11854.0, "rp_user_id":25073877.0 }, "75%":{ "id":9.053052425e+17, "author_id":25073877.0, "retweets":14414.5, "favorites":63094.5, "rp_user_id":99623321.25 }, "max":{ "id":1.075621116e+18, "author_id":25073877.0, "retweets":334538.0, "favorites":589793.0, "rp_user_id":3412873425.0 } } ''' The question categories are: - boolean: Valid answers include True/False, Y/N, Yes/No (all case insensitive). - category: A value from a cell (or a substring of a cell) in the dataset. - number: A numerical value from a cell in the dataset, which may represent a computed statistic (e.g., average, maximum, minimum). - list[category]: A list containing a fixed number of categories. The expected format is: "['cat', 'dog']". Pay attention to the wording of the question to determine if uniqueness is required or if repeated values are allowed. - list[number]: Similar to list[category], but with numbers as its elements. ''' # TODO: complete the following function in one line, by completing the return statement. It should give the answer to: How many rows are there in this dataframe? def example(df: pd.DataFrame): df.columns=["A"] # Expected output type: is number, this will be checked. return df.shape[0] # It should give the answer to: What are the top 6 favorite counts of the tweets? # The answer should only contain python code, you are not allowed leave any TODO undone. def answer(df: pd.DataFrame): # Use df to answer: What are the top 6 favorite counts of the tweets? df.columns = ['id', 'author_id', 'author_name', 'author_handler', 'author_avatar', 'lang', 'text', 'date', 'mention_ids', 'mention_names', 'retweets', 'favorites', 'links', 'links_first', 'image_links', 'image_links_first', 'tweet_link', 'rp_user_id', 'rp_user_name', 'location'] # Expected output type: is list[number], this will be checked. return
20250129013724
259
What are the bottom 3 retweet counts of the tweets?
062_Trump
dev
list[number]
['retweets']
dev
# Instructions: Generate ONLY python code. Do not include explanations. # you can use pandas and numpy. Use the meta data information from df_schema, df_descprtion. import pandas as pd import numpy as np # Description of dataframe schema. df_schema = { "columns": [ { "name": "id", "type": "int64" }, { "name": "author_id", "type": "uint32" }, { "name": "author_name", "type": "category" }, { "name": "author_handler", "type": "category" }, { "name": "author_avatar", "type": "category" }, { "name": "lang", "type": "category" }, { "name": "text", "type": "object" }, { "name": "date", "type": "datetime64[ns, UTC]" }, { "name": "mention_ids", "type": "object" }, { "name": "mention_names", "type": "object" }, { "name": "retweets", "type": "uint32" }, { "name": "favorites", "type": "uint32" }, { "name": "links", "type": "object" }, { "name": "links_first", "type": "category" }, { "name": "image_links", "type": "object" }, { "name": "image_links_first", "type": "category" }, { "name": "tweet_link", "type": "category" }, { "name": "rp_user_id", "type": "float64" }, { "name": "rp_user_name", "type": "category" }, { "name": "location", "type": "category" } ] } # Description of dataframe columns. df_descrption = { "count":{ "id":15039.0, "author_id":15039.0, "retweets":15039.0, "favorites":15039.0, "rp_user_id":38.0 }, "mean":{ "id":7.708974475e+17, "author_id":25073877.0, "retweets":8774.5204468382, "favorites":34438.8956712547, "rp_user_id":409658793.0 }, "std":{ "id":1.524628348e+17, "author_id":0.0, "retweets":11471.4259073933, "favorites":43738.3620217327, "rp_user_id":973036746.0114293098 }, "min":{ "id":5.755855984e+17, "author_id":25073877.0, "retweets":1.0, "favorites":1.0, "rp_user_id":1457641.0 }, "25%":{ "id":6.452230056e+17, "author_id":25073877.0, "retweets":702.5, "favorites":1522.0, "rp_user_id":25073877.0 }, "50%":{ "id":7.232668993e+17, "author_id":25073877.0, "retweets":4216.0, "favorites":11854.0, "rp_user_id":25073877.0 }, "75%":{ "id":9.053052425e+17, "author_id":25073877.0, "retweets":14414.5, "favorites":63094.5, "rp_user_id":99623321.25 }, "max":{ "id":1.075621116e+18, "author_id":25073877.0, "retweets":334538.0, "favorites":589793.0, "rp_user_id":3412873425.0 } } # Randome sample of 10 rows from the dataframe. df_random_sample = { "count":{ "id":15039.0, "author_id":15039.0, "retweets":15039.0, "favorites":15039.0, "rp_user_id":38.0 }, "mean":{ "id":7.708974475e+17, "author_id":25073877.0, "retweets":8774.5204468382, "favorites":34438.8956712547, "rp_user_id":409658793.0 }, "std":{ "id":1.524628348e+17, "author_id":0.0, "retweets":11471.4259073933, "favorites":43738.3620217327, "rp_user_id":973036746.0114293098 }, "min":{ "id":5.755855984e+17, "author_id":25073877.0, "retweets":1.0, "favorites":1.0, "rp_user_id":1457641.0 }, "25%":{ "id":6.452230056e+17, "author_id":25073877.0, "retweets":702.5, "favorites":1522.0, "rp_user_id":25073877.0 }, "50%":{ "id":7.232668993e+17, "author_id":25073877.0, "retweets":4216.0, "favorites":11854.0, "rp_user_id":25073877.0 }, "75%":{ "id":9.053052425e+17, "author_id":25073877.0, "retweets":14414.5, "favorites":63094.5, "rp_user_id":99623321.25 }, "max":{ "id":1.075621116e+18, "author_id":25073877.0, "retweets":334538.0, "favorites":589793.0, "rp_user_id":3412873425.0 } } ''' The question categories are: - boolean: Valid answers include True/False, Y/N, Yes/No (all case insensitive). - category: A value from a cell (or a substring of a cell) in the dataset. - number: A numerical value from a cell in the dataset, which may represent a computed statistic (e.g., average, maximum, minimum). - list[category]: A list containing a fixed number of categories. The expected format is: "['cat', 'dog']". Pay attention to the wording of the question to determine if uniqueness is required or if repeated values are allowed. - list[number]: Similar to list[category], but with numbers as its elements. ''' # TODO: complete the following function in one line, by completing the return statement. It should give the answer to: How many rows are there in this dataframe? def example(df: pd.DataFrame): df.columns=["A"] # Expected output type: is number, this will be checked. return df.shape[0] # It should give the answer to: What are the bottom 3 retweet counts of the tweets? # The answer should only contain python code, you are not allowed leave any TODO undone. def answer(df: pd.DataFrame): # Use df to answer: What are the bottom 3 retweet counts of the tweets? df.columns = ['id', 'author_id', 'author_name', 'author_handler', 'author_avatar', 'lang', 'text', 'date', 'mention_ids', 'mention_names', 'retweets', 'favorites', 'links', 'links_first', 'image_links', 'image_links_first', 'tweet_link', 'rp_user_id', 'rp_user_name', 'location'] # Expected output type: is list[number], this will be checked. return
20250129013724
260
Are there any organizations in the dataset?
063_Influencers
dev
boolean
['is_organization']
dev
# Instructions: Generate ONLY python code. Do not include explanations. # you can use pandas and numpy. Use the meta data information from df_schema, df_descprtion. import pandas as pd import numpy as np # Description of dataframe schema. df_schema = { "columns": [ { "name": "id", "type": "uint32" }, { "name": "name", "type": "category" }, { "name": "pic", "type": "category" }, { "name": "is_organization", "type": "bool" }, { "name": "community", "type": "uint32" }, { "name": "page_rank_norm", "type": "float64" }, { "name": "weight", "type": "float64" }, { "name": "x", "type": "float64" }, { "name": "y", "type": "float64" }, { "name": "twitter_profile_id", "type": "int64" }, { "name": "gx_link_target", "type": "object" }, { "name": "gx_link_weight", "type": "object" }, { "name": "gx_link_reciprocal", "type": "object" }, { "name": "gx_link_should", "type": "object" } ] } # Description of dataframe columns. df_descrption = { "count":{ "id":1039.0, "community":1039.0, "page_rank_norm":1039.0, "weight":1039.0, "x":1039.0, "y":1039.0, "twitter_profile_id":1039.0 }, "mean":{ "id":23047.0644850818, "community":11681769.4696823861, "page_rank_norm":0.0884803326, "weight":147.2675649663, "x":540.3537380859, "y":394.8444226516, "twitter_profile_id":2.008029257e+16 }, "std":{ "id":39075.4047414455, "community":6854727.7264998332, "page_rank_norm":0.1000416103, "weight":118.9822209357, "x":714.4689670341, "y":690.4519130739, "twitter_profile_id":1.345815525e+17 }, "min":{ "id":101.0, "community":2062260.0, "page_rank_norm":0.0, "weight":1.0, "x":-1367.0425072672, "y":-1543.3173448435, "twitter_profile_id":633.0 }, "25%":{ "id":467.5, "community":2062260.0, "page_rank_norm":0.0161780641, "weight":54.0, "x":8.4145058529, "y":-37.4390967754, "twitter_profile_id":17274921.5 }, "50%":{ "id":7209.0, "community":16744206.0, "page_rank_norm":0.0557416047, "weight":120.5, "x":607.9121194347, "y":394.4469887335, "twitter_profile_id":82890309.0 }, "75%":{ "id":35014.5, "community":16744206.0, "page_rank_norm":0.1264938658, "weight":215.0, "x":1100.2234176144, "y":891.8761373502, "twitter_profile_id":412977526.0 }, "max":{ "id":204406.0, "community":16744206.0, "page_rank_norm":1.0, "weight":770.5, "x":2252.6290667868, "y":2101.5421596499, "twitter_profile_id":1.086037534e+18 } } # Randome sample of 10 rows from the dataframe. df_random_sample = { "count":{ "id":1039.0, "community":1039.0, "page_rank_norm":1039.0, "weight":1039.0, "x":1039.0, "y":1039.0, "twitter_profile_id":1039.0 }, "mean":{ "id":23047.0644850818, "community":11681769.4696823861, "page_rank_norm":0.0884803326, "weight":147.2675649663, "x":540.3537380859, "y":394.8444226516, "twitter_profile_id":2.008029257e+16 }, "std":{ "id":39075.4047414455, "community":6854727.7264998332, "page_rank_norm":0.1000416103, "weight":118.9822209357, "x":714.4689670341, "y":690.4519130739, "twitter_profile_id":1.345815525e+17 }, "min":{ "id":101.0, "community":2062260.0, "page_rank_norm":0.0, "weight":1.0, "x":-1367.0425072672, "y":-1543.3173448435, "twitter_profile_id":633.0 }, "25%":{ "id":467.5, "community":2062260.0, "page_rank_norm":0.0161780641, "weight":54.0, "x":8.4145058529, "y":-37.4390967754, "twitter_profile_id":17274921.5 }, "50%":{ "id":7209.0, "community":16744206.0, "page_rank_norm":0.0557416047, "weight":120.5, "x":607.9121194347, "y":394.4469887335, "twitter_profile_id":82890309.0 }, "75%":{ "id":35014.5, "community":16744206.0, "page_rank_norm":0.1264938658, "weight":215.0, "x":1100.2234176144, "y":891.8761373502, "twitter_profile_id":412977526.0 }, "max":{ "id":204406.0, "community":16744206.0, "page_rank_norm":1.0, "weight":770.5, "x":2252.6290667868, "y":2101.5421596499, "twitter_profile_id":1.086037534e+18 } } ''' The question categories are: - boolean: Valid answers include True/False, Y/N, Yes/No (all case insensitive). - category: A value from a cell (or a substring of a cell) in the dataset. - number: A numerical value from a cell in the dataset, which may represent a computed statistic (e.g., average, maximum, minimum). - list[category]: A list containing a fixed number of categories. The expected format is: "['cat', 'dog']". Pay attention to the wording of the question to determine if uniqueness is required or if repeated values are allowed. - list[number]: Similar to list[category], but with numbers as its elements. ''' # TODO: complete the following function in one line, by completing the return statement. It should give the answer to: How many rows are there in this dataframe? def example(df: pd.DataFrame): df.columns=["A"] # Expected output type: is number, this will be checked. return df.shape[0] # It should give the answer to: Are there any organizations in the dataset? # The answer should only contain python code, you are not allowed leave any TODO undone. def answer(df: pd.DataFrame): # Use df to answer: Are there any organizations in the dataset? df.columns = ['id', 'name', 'pic', 'is_organization', 'community', 'page_rank_norm', 'weight', 'x', 'y', 'twitter_profile_id', 'gx_link_target', 'gx_link_weight', 'gx_link_reciprocal', 'gx_link_should'] # Expected output type: is boolean, this will be checked. return
20250129013724
261
Are there any individuals (non-organizations) in the dataset?
063_Influencers
dev
boolean
['is_organization']
dev
# Instructions: Generate ONLY python code. Do not include explanations. # you can use pandas and numpy. Use the meta data information from df_schema, df_descprtion. import pandas as pd import numpy as np # Description of dataframe schema. df_schema = { "columns": [ { "name": "id", "type": "uint32" }, { "name": "name", "type": "category" }, { "name": "pic", "type": "category" }, { "name": "is_organization", "type": "bool" }, { "name": "community", "type": "uint32" }, { "name": "page_rank_norm", "type": "float64" }, { "name": "weight", "type": "float64" }, { "name": "x", "type": "float64" }, { "name": "y", "type": "float64" }, { "name": "twitter_profile_id", "type": "int64" }, { "name": "gx_link_target", "type": "object" }, { "name": "gx_link_weight", "type": "object" }, { "name": "gx_link_reciprocal", "type": "object" }, { "name": "gx_link_should", "type": "object" } ] } # Description of dataframe columns. df_descrption = { "count":{ "id":1039.0, "community":1039.0, "page_rank_norm":1039.0, "weight":1039.0, "x":1039.0, "y":1039.0, "twitter_profile_id":1039.0 }, "mean":{ "id":23047.0644850818, "community":11681769.4696823861, "page_rank_norm":0.0884803326, "weight":147.2675649663, "x":540.3537380859, "y":394.8444226516, "twitter_profile_id":2.008029257e+16 }, "std":{ "id":39075.4047414455, "community":6854727.7264998332, "page_rank_norm":0.1000416103, "weight":118.9822209357, "x":714.4689670341, "y":690.4519130739, "twitter_profile_id":1.345815525e+17 }, "min":{ "id":101.0, "community":2062260.0, "page_rank_norm":0.0, "weight":1.0, "x":-1367.0425072672, "y":-1543.3173448435, "twitter_profile_id":633.0 }, "25%":{ "id":467.5, "community":2062260.0, "page_rank_norm":0.0161780641, "weight":54.0, "x":8.4145058529, "y":-37.4390967754, "twitter_profile_id":17274921.5 }, "50%":{ "id":7209.0, "community":16744206.0, "page_rank_norm":0.0557416047, "weight":120.5, "x":607.9121194347, "y":394.4469887335, "twitter_profile_id":82890309.0 }, "75%":{ "id":35014.5, "community":16744206.0, "page_rank_norm":0.1264938658, "weight":215.0, "x":1100.2234176144, "y":891.8761373502, "twitter_profile_id":412977526.0 }, "max":{ "id":204406.0, "community":16744206.0, "page_rank_norm":1.0, "weight":770.5, "x":2252.6290667868, "y":2101.5421596499, "twitter_profile_id":1.086037534e+18 } } # Randome sample of 10 rows from the dataframe. df_random_sample = { "count":{ "id":1039.0, "community":1039.0, "page_rank_norm":1039.0, "weight":1039.0, "x":1039.0, "y":1039.0, "twitter_profile_id":1039.0 }, "mean":{ "id":23047.0644850818, "community":11681769.4696823861, "page_rank_norm":0.0884803326, "weight":147.2675649663, "x":540.3537380859, "y":394.8444226516, "twitter_profile_id":2.008029257e+16 }, "std":{ "id":39075.4047414455, "community":6854727.7264998332, "page_rank_norm":0.1000416103, "weight":118.9822209357, "x":714.4689670341, "y":690.4519130739, "twitter_profile_id":1.345815525e+17 }, "min":{ "id":101.0, "community":2062260.0, "page_rank_norm":0.0, "weight":1.0, "x":-1367.0425072672, "y":-1543.3173448435, "twitter_profile_id":633.0 }, "25%":{ "id":467.5, "community":2062260.0, "page_rank_norm":0.0161780641, "weight":54.0, "x":8.4145058529, "y":-37.4390967754, "twitter_profile_id":17274921.5 }, "50%":{ "id":7209.0, "community":16744206.0, "page_rank_norm":0.0557416047, "weight":120.5, "x":607.9121194347, "y":394.4469887335, "twitter_profile_id":82890309.0 }, "75%":{ "id":35014.5, "community":16744206.0, "page_rank_norm":0.1264938658, "weight":215.0, "x":1100.2234176144, "y":891.8761373502, "twitter_profile_id":412977526.0 }, "max":{ "id":204406.0, "community":16744206.0, "page_rank_norm":1.0, "weight":770.5, "x":2252.6290667868, "y":2101.5421596499, "twitter_profile_id":1.086037534e+18 } } ''' The question categories are: - boolean: Valid answers include True/False, Y/N, Yes/No (all case insensitive). - category: A value from a cell (or a substring of a cell) in the dataset. - number: A numerical value from a cell in the dataset, which may represent a computed statistic (e.g., average, maximum, minimum). - list[category]: A list containing a fixed number of categories. The expected format is: "['cat', 'dog']". Pay attention to the wording of the question to determine if uniqueness is required or if repeated values are allowed. - list[number]: Similar to list[category], but with numbers as its elements. ''' # TODO: complete the following function in one line, by completing the return statement. It should give the answer to: How many rows are there in this dataframe? def example(df: pd.DataFrame): df.columns=["A"] # Expected output type: is number, this will be checked. return df.shape[0] # It should give the answer to: Are there any individuals (non-organizations) in the dataset? # The answer should only contain python code, you are not allowed leave any TODO undone. def answer(df: pd.DataFrame): # Use df to answer: Are there any individuals (non-organizations) in the dataset? df.columns = ['id', 'name', 'pic', 'is_organization', 'community', 'page_rank_norm', 'weight', 'x', 'y', 'twitter_profile_id', 'gx_link_target', 'gx_link_weight', 'gx_link_reciprocal', 'gx_link_should'] # Expected output type: is boolean, this will be checked. return
20250129013724
262
Do all entities have a picture?
063_Influencers
dev
boolean
['pic']
dev
# Instructions: Generate ONLY python code. Do not include explanations. # you can use pandas and numpy. Use the meta data information from df_schema, df_descprtion. import pandas as pd import numpy as np # Description of dataframe schema. df_schema = { "columns": [ { "name": "id", "type": "uint32" }, { "name": "name", "type": "category" }, { "name": "pic", "type": "category" }, { "name": "is_organization", "type": "bool" }, { "name": "community", "type": "uint32" }, { "name": "page_rank_norm", "type": "float64" }, { "name": "weight", "type": "float64" }, { "name": "x", "type": "float64" }, { "name": "y", "type": "float64" }, { "name": "twitter_profile_id", "type": "int64" }, { "name": "gx_link_target", "type": "object" }, { "name": "gx_link_weight", "type": "object" }, { "name": "gx_link_reciprocal", "type": "object" }, { "name": "gx_link_should", "type": "object" } ] } # Description of dataframe columns. df_descrption = { "count":{ "id":1039.0, "community":1039.0, "page_rank_norm":1039.0, "weight":1039.0, "x":1039.0, "y":1039.0, "twitter_profile_id":1039.0 }, "mean":{ "id":23047.0644850818, "community":11681769.4696823861, "page_rank_norm":0.0884803326, "weight":147.2675649663, "x":540.3537380859, "y":394.8444226516, "twitter_profile_id":2.008029257e+16 }, "std":{ "id":39075.4047414455, "community":6854727.7264998332, "page_rank_norm":0.1000416103, "weight":118.9822209357, "x":714.4689670341, "y":690.4519130739, "twitter_profile_id":1.345815525e+17 }, "min":{ "id":101.0, "community":2062260.0, "page_rank_norm":0.0, "weight":1.0, "x":-1367.0425072672, "y":-1543.3173448435, "twitter_profile_id":633.0 }, "25%":{ "id":467.5, "community":2062260.0, "page_rank_norm":0.0161780641, "weight":54.0, "x":8.4145058529, "y":-37.4390967754, "twitter_profile_id":17274921.5 }, "50%":{ "id":7209.0, "community":16744206.0, "page_rank_norm":0.0557416047, "weight":120.5, "x":607.9121194347, "y":394.4469887335, "twitter_profile_id":82890309.0 }, "75%":{ "id":35014.5, "community":16744206.0, "page_rank_norm":0.1264938658, "weight":215.0, "x":1100.2234176144, "y":891.8761373502, "twitter_profile_id":412977526.0 }, "max":{ "id":204406.0, "community":16744206.0, "page_rank_norm":1.0, "weight":770.5, "x":2252.6290667868, "y":2101.5421596499, "twitter_profile_id":1.086037534e+18 } } # Randome sample of 10 rows from the dataframe. df_random_sample = { "count":{ "id":1039.0, "community":1039.0, "page_rank_norm":1039.0, "weight":1039.0, "x":1039.0, "y":1039.0, "twitter_profile_id":1039.0 }, "mean":{ "id":23047.0644850818, "community":11681769.4696823861, "page_rank_norm":0.0884803326, "weight":147.2675649663, "x":540.3537380859, "y":394.8444226516, "twitter_profile_id":2.008029257e+16 }, "std":{ "id":39075.4047414455, "community":6854727.7264998332, "page_rank_norm":0.1000416103, "weight":118.9822209357, "x":714.4689670341, "y":690.4519130739, "twitter_profile_id":1.345815525e+17 }, "min":{ "id":101.0, "community":2062260.0, "page_rank_norm":0.0, "weight":1.0, "x":-1367.0425072672, "y":-1543.3173448435, "twitter_profile_id":633.0 }, "25%":{ "id":467.5, "community":2062260.0, "page_rank_norm":0.0161780641, "weight":54.0, "x":8.4145058529, "y":-37.4390967754, "twitter_profile_id":17274921.5 }, "50%":{ "id":7209.0, "community":16744206.0, "page_rank_norm":0.0557416047, "weight":120.5, "x":607.9121194347, "y":394.4469887335, "twitter_profile_id":82890309.0 }, "75%":{ "id":35014.5, "community":16744206.0, "page_rank_norm":0.1264938658, "weight":215.0, "x":1100.2234176144, "y":891.8761373502, "twitter_profile_id":412977526.0 }, "max":{ "id":204406.0, "community":16744206.0, "page_rank_norm":1.0, "weight":770.5, "x":2252.6290667868, "y":2101.5421596499, "twitter_profile_id":1.086037534e+18 } } ''' The question categories are: - boolean: Valid answers include True/False, Y/N, Yes/No (all case insensitive). - category: A value from a cell (or a substring of a cell) in the dataset. - number: A numerical value from a cell in the dataset, which may represent a computed statistic (e.g., average, maximum, minimum). - list[category]: A list containing a fixed number of categories. The expected format is: "['cat', 'dog']". Pay attention to the wording of the question to determine if uniqueness is required or if repeated values are allowed. - list[number]: Similar to list[category], but with numbers as its elements. ''' # TODO: complete the following function in one line, by completing the return statement. It should give the answer to: How many rows are there in this dataframe? def example(df: pd.DataFrame): df.columns=["A"] # Expected output type: is number, this will be checked. return df.shape[0] # It should give the answer to: Do all entities have a picture? # The answer should only contain python code, you are not allowed leave any TODO undone. def answer(df: pd.DataFrame): # Use df to answer: Do all entities have a picture? df.columns = ['id', 'name', 'pic', 'is_organization', 'community', 'page_rank_norm', 'weight', 'x', 'y', 'twitter_profile_id', 'gx_link_target', 'gx_link_weight', 'gx_link_reciprocal', 'gx_link_should'] # Expected output type: is boolean, this will be checked. return
20250129013724
263
Are there any entities with a weight greater than 500?
063_Influencers
dev
boolean
['weight']
dev
# Instructions: Generate ONLY python code. Do not include explanations. # you can use pandas and numpy. Use the meta data information from df_schema, df_descprtion. import pandas as pd import numpy as np # Description of dataframe schema. df_schema = { "columns": [ { "name": "id", "type": "uint32" }, { "name": "name", "type": "category" }, { "name": "pic", "type": "category" }, { "name": "is_organization", "type": "bool" }, { "name": "community", "type": "uint32" }, { "name": "page_rank_norm", "type": "float64" }, { "name": "weight", "type": "float64" }, { "name": "x", "type": "float64" }, { "name": "y", "type": "float64" }, { "name": "twitter_profile_id", "type": "int64" }, { "name": "gx_link_target", "type": "object" }, { "name": "gx_link_weight", "type": "object" }, { "name": "gx_link_reciprocal", "type": "object" }, { "name": "gx_link_should", "type": "object" } ] } # Description of dataframe columns. df_descrption = { "count":{ "id":1039.0, "community":1039.0, "page_rank_norm":1039.0, "weight":1039.0, "x":1039.0, "y":1039.0, "twitter_profile_id":1039.0 }, "mean":{ "id":23047.0644850818, "community":11681769.4696823861, "page_rank_norm":0.0884803326, "weight":147.2675649663, "x":540.3537380859, "y":394.8444226516, "twitter_profile_id":2.008029257e+16 }, "std":{ "id":39075.4047414455, "community":6854727.7264998332, "page_rank_norm":0.1000416103, "weight":118.9822209357, "x":714.4689670341, "y":690.4519130739, "twitter_profile_id":1.345815525e+17 }, "min":{ "id":101.0, "community":2062260.0, "page_rank_norm":0.0, "weight":1.0, "x":-1367.0425072672, "y":-1543.3173448435, "twitter_profile_id":633.0 }, "25%":{ "id":467.5, "community":2062260.0, "page_rank_norm":0.0161780641, "weight":54.0, "x":8.4145058529, "y":-37.4390967754, "twitter_profile_id":17274921.5 }, "50%":{ "id":7209.0, "community":16744206.0, "page_rank_norm":0.0557416047, "weight":120.5, "x":607.9121194347, "y":394.4469887335, "twitter_profile_id":82890309.0 }, "75%":{ "id":35014.5, "community":16744206.0, "page_rank_norm":0.1264938658, "weight":215.0, "x":1100.2234176144, "y":891.8761373502, "twitter_profile_id":412977526.0 }, "max":{ "id":204406.0, "community":16744206.0, "page_rank_norm":1.0, "weight":770.5, "x":2252.6290667868, "y":2101.5421596499, "twitter_profile_id":1.086037534e+18 } } # Randome sample of 10 rows from the dataframe. df_random_sample = { "count":{ "id":1039.0, "community":1039.0, "page_rank_norm":1039.0, "weight":1039.0, "x":1039.0, "y":1039.0, "twitter_profile_id":1039.0 }, "mean":{ "id":23047.0644850818, "community":11681769.4696823861, "page_rank_norm":0.0884803326, "weight":147.2675649663, "x":540.3537380859, "y":394.8444226516, "twitter_profile_id":2.008029257e+16 }, "std":{ "id":39075.4047414455, "community":6854727.7264998332, "page_rank_norm":0.1000416103, "weight":118.9822209357, "x":714.4689670341, "y":690.4519130739, "twitter_profile_id":1.345815525e+17 }, "min":{ "id":101.0, "community":2062260.0, "page_rank_norm":0.0, "weight":1.0, "x":-1367.0425072672, "y":-1543.3173448435, "twitter_profile_id":633.0 }, "25%":{ "id":467.5, "community":2062260.0, "page_rank_norm":0.0161780641, "weight":54.0, "x":8.4145058529, "y":-37.4390967754, "twitter_profile_id":17274921.5 }, "50%":{ "id":7209.0, "community":16744206.0, "page_rank_norm":0.0557416047, "weight":120.5, "x":607.9121194347, "y":394.4469887335, "twitter_profile_id":82890309.0 }, "75%":{ "id":35014.5, "community":16744206.0, "page_rank_norm":0.1264938658, "weight":215.0, "x":1100.2234176144, "y":891.8761373502, "twitter_profile_id":412977526.0 }, "max":{ "id":204406.0, "community":16744206.0, "page_rank_norm":1.0, "weight":770.5, "x":2252.6290667868, "y":2101.5421596499, "twitter_profile_id":1.086037534e+18 } } ''' The question categories are: - boolean: Valid answers include True/False, Y/N, Yes/No (all case insensitive). - category: A value from a cell (or a substring of a cell) in the dataset. - number: A numerical value from a cell in the dataset, which may represent a computed statistic (e.g., average, maximum, minimum). - list[category]: A list containing a fixed number of categories. The expected format is: "['cat', 'dog']". Pay attention to the wording of the question to determine if uniqueness is required or if repeated values are allowed. - list[number]: Similar to list[category], but with numbers as its elements. ''' # TODO: complete the following function in one line, by completing the return statement. It should give the answer to: How many rows are there in this dataframe? def example(df: pd.DataFrame): df.columns=["A"] # Expected output type: is number, this will be checked. return df.shape[0] # It should give the answer to: Are there any entities with a weight greater than 500? # The answer should only contain python code, you are not allowed leave any TODO undone. def answer(df: pd.DataFrame): # Use df to answer: Are there any entities with a weight greater than 500? df.columns = ['id', 'name', 'pic', 'is_organization', 'community', 'page_rank_norm', 'weight', 'x', 'y', 'twitter_profile_id', 'gx_link_target', 'gx_link_weight', 'gx_link_reciprocal', 'gx_link_should'] # Expected output type: is boolean, this will be checked. return
20250129013724
264
How many unique communities are there?
063_Influencers
dev
number
['community']
dev
# Instructions: Generate ONLY python code. Do not include explanations. # you can use pandas and numpy. Use the meta data information from df_schema, df_descprtion. import pandas as pd import numpy as np # Description of dataframe schema. df_schema = { "columns": [ { "name": "id", "type": "uint32" }, { "name": "name", "type": "category" }, { "name": "pic", "type": "category" }, { "name": "is_organization", "type": "bool" }, { "name": "community", "type": "uint32" }, { "name": "page_rank_norm", "type": "float64" }, { "name": "weight", "type": "float64" }, { "name": "x", "type": "float64" }, { "name": "y", "type": "float64" }, { "name": "twitter_profile_id", "type": "int64" }, { "name": "gx_link_target", "type": "object" }, { "name": "gx_link_weight", "type": "object" }, { "name": "gx_link_reciprocal", "type": "object" }, { "name": "gx_link_should", "type": "object" } ] } # Description of dataframe columns. df_descrption = { "count":{ "id":1039.0, "community":1039.0, "page_rank_norm":1039.0, "weight":1039.0, "x":1039.0, "y":1039.0, "twitter_profile_id":1039.0 }, "mean":{ "id":23047.0644850818, "community":11681769.4696823861, "page_rank_norm":0.0884803326, "weight":147.2675649663, "x":540.3537380859, "y":394.8444226516, "twitter_profile_id":2.008029257e+16 }, "std":{ "id":39075.4047414455, "community":6854727.7264998332, "page_rank_norm":0.1000416103, "weight":118.9822209357, "x":714.4689670341, "y":690.4519130739, "twitter_profile_id":1.345815525e+17 }, "min":{ "id":101.0, "community":2062260.0, "page_rank_norm":0.0, "weight":1.0, "x":-1367.0425072672, "y":-1543.3173448435, "twitter_profile_id":633.0 }, "25%":{ "id":467.5, "community":2062260.0, "page_rank_norm":0.0161780641, "weight":54.0, "x":8.4145058529, "y":-37.4390967754, "twitter_profile_id":17274921.5 }, "50%":{ "id":7209.0, "community":16744206.0, "page_rank_norm":0.0557416047, "weight":120.5, "x":607.9121194347, "y":394.4469887335, "twitter_profile_id":82890309.0 }, "75%":{ "id":35014.5, "community":16744206.0, "page_rank_norm":0.1264938658, "weight":215.0, "x":1100.2234176144, "y":891.8761373502, "twitter_profile_id":412977526.0 }, "max":{ "id":204406.0, "community":16744206.0, "page_rank_norm":1.0, "weight":770.5, "x":2252.6290667868, "y":2101.5421596499, "twitter_profile_id":1.086037534e+18 } } # Randome sample of 10 rows from the dataframe. df_random_sample = { "count":{ "id":1039.0, "community":1039.0, "page_rank_norm":1039.0, "weight":1039.0, "x":1039.0, "y":1039.0, "twitter_profile_id":1039.0 }, "mean":{ "id":23047.0644850818, "community":11681769.4696823861, "page_rank_norm":0.0884803326, "weight":147.2675649663, "x":540.3537380859, "y":394.8444226516, "twitter_profile_id":2.008029257e+16 }, "std":{ "id":39075.4047414455, "community":6854727.7264998332, "page_rank_norm":0.1000416103, "weight":118.9822209357, "x":714.4689670341, "y":690.4519130739, "twitter_profile_id":1.345815525e+17 }, "min":{ "id":101.0, "community":2062260.0, "page_rank_norm":0.0, "weight":1.0, "x":-1367.0425072672, "y":-1543.3173448435, "twitter_profile_id":633.0 }, "25%":{ "id":467.5, "community":2062260.0, "page_rank_norm":0.0161780641, "weight":54.0, "x":8.4145058529, "y":-37.4390967754, "twitter_profile_id":17274921.5 }, "50%":{ "id":7209.0, "community":16744206.0, "page_rank_norm":0.0557416047, "weight":120.5, "x":607.9121194347, "y":394.4469887335, "twitter_profile_id":82890309.0 }, "75%":{ "id":35014.5, "community":16744206.0, "page_rank_norm":0.1264938658, "weight":215.0, "x":1100.2234176144, "y":891.8761373502, "twitter_profile_id":412977526.0 }, "max":{ "id":204406.0, "community":16744206.0, "page_rank_norm":1.0, "weight":770.5, "x":2252.6290667868, "y":2101.5421596499, "twitter_profile_id":1.086037534e+18 } } ''' The question categories are: - boolean: Valid answers include True/False, Y/N, Yes/No (all case insensitive). - category: A value from a cell (or a substring of a cell) in the dataset. - number: A numerical value from a cell in the dataset, which may represent a computed statistic (e.g., average, maximum, minimum). - list[category]: A list containing a fixed number of categories. The expected format is: "['cat', 'dog']". Pay attention to the wording of the question to determine if uniqueness is required or if repeated values are allowed. - list[number]: Similar to list[category], but with numbers as its elements. ''' # TODO: complete the following function in one line, by completing the return statement. It should give the answer to: How many rows are there in this dataframe? def example(df: pd.DataFrame): df.columns=["A"] # Expected output type: is number, this will be checked. return df.shape[0] # It should give the answer to: How many unique communities are there? # The answer should only contain python code, you are not allowed leave any TODO undone. def answer(df: pd.DataFrame): # Use df to answer: How many unique communities are there? df.columns = ['id', 'name', 'pic', 'is_organization', 'community', 'page_rank_norm', 'weight', 'x', 'y', 'twitter_profile_id', 'gx_link_target', 'gx_link_weight', 'gx_link_reciprocal', 'gx_link_should'] # Expected output type: is number, this will be checked. return
20250129013724
265
What is the average page rank norm?
063_Influencers
dev
number
['page_rank_norm']
dev
# Instructions: Generate ONLY python code. Do not include explanations. # you can use pandas and numpy. Use the meta data information from df_schema, df_descprtion. import pandas as pd import numpy as np # Description of dataframe schema. df_schema = { "columns": [ { "name": "id", "type": "uint32" }, { "name": "name", "type": "category" }, { "name": "pic", "type": "category" }, { "name": "is_organization", "type": "bool" }, { "name": "community", "type": "uint32" }, { "name": "page_rank_norm", "type": "float64" }, { "name": "weight", "type": "float64" }, { "name": "x", "type": "float64" }, { "name": "y", "type": "float64" }, { "name": "twitter_profile_id", "type": "int64" }, { "name": "gx_link_target", "type": "object" }, { "name": "gx_link_weight", "type": "object" }, { "name": "gx_link_reciprocal", "type": "object" }, { "name": "gx_link_should", "type": "object" } ] } # Description of dataframe columns. df_descrption = { "count":{ "id":1039.0, "community":1039.0, "page_rank_norm":1039.0, "weight":1039.0, "x":1039.0, "y":1039.0, "twitter_profile_id":1039.0 }, "mean":{ "id":23047.0644850818, "community":11681769.4696823861, "page_rank_norm":0.0884803326, "weight":147.2675649663, "x":540.3537380859, "y":394.8444226516, "twitter_profile_id":2.008029257e+16 }, "std":{ "id":39075.4047414455, "community":6854727.7264998332, "page_rank_norm":0.1000416103, "weight":118.9822209357, "x":714.4689670341, "y":690.4519130739, "twitter_profile_id":1.345815525e+17 }, "min":{ "id":101.0, "community":2062260.0, "page_rank_norm":0.0, "weight":1.0, "x":-1367.0425072672, "y":-1543.3173448435, "twitter_profile_id":633.0 }, "25%":{ "id":467.5, "community":2062260.0, "page_rank_norm":0.0161780641, "weight":54.0, "x":8.4145058529, "y":-37.4390967754, "twitter_profile_id":17274921.5 }, "50%":{ "id":7209.0, "community":16744206.0, "page_rank_norm":0.0557416047, "weight":120.5, "x":607.9121194347, "y":394.4469887335, "twitter_profile_id":82890309.0 }, "75%":{ "id":35014.5, "community":16744206.0, "page_rank_norm":0.1264938658, "weight":215.0, "x":1100.2234176144, "y":891.8761373502, "twitter_profile_id":412977526.0 }, "max":{ "id":204406.0, "community":16744206.0, "page_rank_norm":1.0, "weight":770.5, "x":2252.6290667868, "y":2101.5421596499, "twitter_profile_id":1.086037534e+18 } } # Randome sample of 10 rows from the dataframe. df_random_sample = { "count":{ "id":1039.0, "community":1039.0, "page_rank_norm":1039.0, "weight":1039.0, "x":1039.0, "y":1039.0, "twitter_profile_id":1039.0 }, "mean":{ "id":23047.0644850818, "community":11681769.4696823861, "page_rank_norm":0.0884803326, "weight":147.2675649663, "x":540.3537380859, "y":394.8444226516, "twitter_profile_id":2.008029257e+16 }, "std":{ "id":39075.4047414455, "community":6854727.7264998332, "page_rank_norm":0.1000416103, "weight":118.9822209357, "x":714.4689670341, "y":690.4519130739, "twitter_profile_id":1.345815525e+17 }, "min":{ "id":101.0, "community":2062260.0, "page_rank_norm":0.0, "weight":1.0, "x":-1367.0425072672, "y":-1543.3173448435, "twitter_profile_id":633.0 }, "25%":{ "id":467.5, "community":2062260.0, "page_rank_norm":0.0161780641, "weight":54.0, "x":8.4145058529, "y":-37.4390967754, "twitter_profile_id":17274921.5 }, "50%":{ "id":7209.0, "community":16744206.0, "page_rank_norm":0.0557416047, "weight":120.5, "x":607.9121194347, "y":394.4469887335, "twitter_profile_id":82890309.0 }, "75%":{ "id":35014.5, "community":16744206.0, "page_rank_norm":0.1264938658, "weight":215.0, "x":1100.2234176144, "y":891.8761373502, "twitter_profile_id":412977526.0 }, "max":{ "id":204406.0, "community":16744206.0, "page_rank_norm":1.0, "weight":770.5, "x":2252.6290667868, "y":2101.5421596499, "twitter_profile_id":1.086037534e+18 } } ''' The question categories are: - boolean: Valid answers include True/False, Y/N, Yes/No (all case insensitive). - category: A value from a cell (or a substring of a cell) in the dataset. - number: A numerical value from a cell in the dataset, which may represent a computed statistic (e.g., average, maximum, minimum). - list[category]: A list containing a fixed number of categories. The expected format is: "['cat', 'dog']". Pay attention to the wording of the question to determine if uniqueness is required or if repeated values are allowed. - list[number]: Similar to list[category], but with numbers as its elements. ''' # TODO: complete the following function in one line, by completing the return statement. It should give the answer to: How many rows are there in this dataframe? def example(df: pd.DataFrame): df.columns=["A"] # Expected output type: is number, this will be checked. return df.shape[0] # It should give the answer to: What is the average page rank norm? # The answer should only contain python code, you are not allowed leave any TODO undone. def answer(df: pd.DataFrame): # Use df to answer: What is the average page rank norm? df.columns = ['id', 'name', 'pic', 'is_organization', 'community', 'page_rank_norm', 'weight', 'x', 'y', 'twitter_profile_id', 'gx_link_target', 'gx_link_weight', 'gx_link_reciprocal', 'gx_link_should'] # Expected output type: is number, this will be checked. return
20250129013724
266
What is the maximum weight of an entity?
063_Influencers
dev
number
['weight']
dev
# Instructions: Generate ONLY python code. Do not include explanations. # you can use pandas and numpy. Use the meta data information from df_schema, df_descprtion. import pandas as pd import numpy as np # Description of dataframe schema. df_schema = { "columns": [ { "name": "id", "type": "uint32" }, { "name": "name", "type": "category" }, { "name": "pic", "type": "category" }, { "name": "is_organization", "type": "bool" }, { "name": "community", "type": "uint32" }, { "name": "page_rank_norm", "type": "float64" }, { "name": "weight", "type": "float64" }, { "name": "x", "type": "float64" }, { "name": "y", "type": "float64" }, { "name": "twitter_profile_id", "type": "int64" }, { "name": "gx_link_target", "type": "object" }, { "name": "gx_link_weight", "type": "object" }, { "name": "gx_link_reciprocal", "type": "object" }, { "name": "gx_link_should", "type": "object" } ] } # Description of dataframe columns. df_descrption = { "count":{ "id":1039.0, "community":1039.0, "page_rank_norm":1039.0, "weight":1039.0, "x":1039.0, "y":1039.0, "twitter_profile_id":1039.0 }, "mean":{ "id":23047.0644850818, "community":11681769.4696823861, "page_rank_norm":0.0884803326, "weight":147.2675649663, "x":540.3537380859, "y":394.8444226516, "twitter_profile_id":2.008029257e+16 }, "std":{ "id":39075.4047414455, "community":6854727.7264998332, "page_rank_norm":0.1000416103, "weight":118.9822209357, "x":714.4689670341, "y":690.4519130739, "twitter_profile_id":1.345815525e+17 }, "min":{ "id":101.0, "community":2062260.0, "page_rank_norm":0.0, "weight":1.0, "x":-1367.0425072672, "y":-1543.3173448435, "twitter_profile_id":633.0 }, "25%":{ "id":467.5, "community":2062260.0, "page_rank_norm":0.0161780641, "weight":54.0, "x":8.4145058529, "y":-37.4390967754, "twitter_profile_id":17274921.5 }, "50%":{ "id":7209.0, "community":16744206.0, "page_rank_norm":0.0557416047, "weight":120.5, "x":607.9121194347, "y":394.4469887335, "twitter_profile_id":82890309.0 }, "75%":{ "id":35014.5, "community":16744206.0, "page_rank_norm":0.1264938658, "weight":215.0, "x":1100.2234176144, "y":891.8761373502, "twitter_profile_id":412977526.0 }, "max":{ "id":204406.0, "community":16744206.0, "page_rank_norm":1.0, "weight":770.5, "x":2252.6290667868, "y":2101.5421596499, "twitter_profile_id":1.086037534e+18 } } # Randome sample of 10 rows from the dataframe. df_random_sample = { "count":{ "id":1039.0, "community":1039.0, "page_rank_norm":1039.0, "weight":1039.0, "x":1039.0, "y":1039.0, "twitter_profile_id":1039.0 }, "mean":{ "id":23047.0644850818, "community":11681769.4696823861, "page_rank_norm":0.0884803326, "weight":147.2675649663, "x":540.3537380859, "y":394.8444226516, "twitter_profile_id":2.008029257e+16 }, "std":{ "id":39075.4047414455, "community":6854727.7264998332, "page_rank_norm":0.1000416103, "weight":118.9822209357, "x":714.4689670341, "y":690.4519130739, "twitter_profile_id":1.345815525e+17 }, "min":{ "id":101.0, "community":2062260.0, "page_rank_norm":0.0, "weight":1.0, "x":-1367.0425072672, "y":-1543.3173448435, "twitter_profile_id":633.0 }, "25%":{ "id":467.5, "community":2062260.0, "page_rank_norm":0.0161780641, "weight":54.0, "x":8.4145058529, "y":-37.4390967754, "twitter_profile_id":17274921.5 }, "50%":{ "id":7209.0, "community":16744206.0, "page_rank_norm":0.0557416047, "weight":120.5, "x":607.9121194347, "y":394.4469887335, "twitter_profile_id":82890309.0 }, "75%":{ "id":35014.5, "community":16744206.0, "page_rank_norm":0.1264938658, "weight":215.0, "x":1100.2234176144, "y":891.8761373502, "twitter_profile_id":412977526.0 }, "max":{ "id":204406.0, "community":16744206.0, "page_rank_norm":1.0, "weight":770.5, "x":2252.6290667868, "y":2101.5421596499, "twitter_profile_id":1.086037534e+18 } } ''' The question categories are: - boolean: Valid answers include True/False, Y/N, Yes/No (all case insensitive). - category: A value from a cell (or a substring of a cell) in the dataset. - number: A numerical value from a cell in the dataset, which may represent a computed statistic (e.g., average, maximum, minimum). - list[category]: A list containing a fixed number of categories. The expected format is: "['cat', 'dog']". Pay attention to the wording of the question to determine if uniqueness is required or if repeated values are allowed. - list[number]: Similar to list[category], but with numbers as its elements. ''' # TODO: complete the following function in one line, by completing the return statement. It should give the answer to: How many rows are there in this dataframe? def example(df: pd.DataFrame): df.columns=["A"] # Expected output type: is number, this will be checked. return df.shape[0] # It should give the answer to: What is the maximum weight of an entity? # The answer should only contain python code, you are not allowed leave any TODO undone. def answer(df: pd.DataFrame): # Use df to answer: What is the maximum weight of an entity? df.columns = ['id', 'name', 'pic', 'is_organization', 'community', 'page_rank_norm', 'weight', 'x', 'y', 'twitter_profile_id', 'gx_link_target', 'gx_link_weight', 'gx_link_reciprocal', 'gx_link_should'] # Expected output type: is number, this will be checked. return
20250129013724
267
How many entities have a community identifier of 16744206?
063_Influencers
dev
number
['community']
dev
# Instructions: Generate ONLY python code. Do not include explanations. # you can use pandas and numpy. Use the meta data information from df_schema, df_descprtion. import pandas as pd import numpy as np # Description of dataframe schema. df_schema = { "columns": [ { "name": "id", "type": "uint32" }, { "name": "name", "type": "category" }, { "name": "pic", "type": "category" }, { "name": "is_organization", "type": "bool" }, { "name": "community", "type": "uint32" }, { "name": "page_rank_norm", "type": "float64" }, { "name": "weight", "type": "float64" }, { "name": "x", "type": "float64" }, { "name": "y", "type": "float64" }, { "name": "twitter_profile_id", "type": "int64" }, { "name": "gx_link_target", "type": "object" }, { "name": "gx_link_weight", "type": "object" }, { "name": "gx_link_reciprocal", "type": "object" }, { "name": "gx_link_should", "type": "object" } ] } # Description of dataframe columns. df_descrption = { "count":{ "id":1039.0, "community":1039.0, "page_rank_norm":1039.0, "weight":1039.0, "x":1039.0, "y":1039.0, "twitter_profile_id":1039.0 }, "mean":{ "id":23047.0644850818, "community":11681769.4696823861, "page_rank_norm":0.0884803326, "weight":147.2675649663, "x":540.3537380859, "y":394.8444226516, "twitter_profile_id":2.008029257e+16 }, "std":{ "id":39075.4047414455, "community":6854727.7264998332, "page_rank_norm":0.1000416103, "weight":118.9822209357, "x":714.4689670341, "y":690.4519130739, "twitter_profile_id":1.345815525e+17 }, "min":{ "id":101.0, "community":2062260.0, "page_rank_norm":0.0, "weight":1.0, "x":-1367.0425072672, "y":-1543.3173448435, "twitter_profile_id":633.0 }, "25%":{ "id":467.5, "community":2062260.0, "page_rank_norm":0.0161780641, "weight":54.0, "x":8.4145058529, "y":-37.4390967754, "twitter_profile_id":17274921.5 }, "50%":{ "id":7209.0, "community":16744206.0, "page_rank_norm":0.0557416047, "weight":120.5, "x":607.9121194347, "y":394.4469887335, "twitter_profile_id":82890309.0 }, "75%":{ "id":35014.5, "community":16744206.0, "page_rank_norm":0.1264938658, "weight":215.0, "x":1100.2234176144, "y":891.8761373502, "twitter_profile_id":412977526.0 }, "max":{ "id":204406.0, "community":16744206.0, "page_rank_norm":1.0, "weight":770.5, "x":2252.6290667868, "y":2101.5421596499, "twitter_profile_id":1.086037534e+18 } } # Randome sample of 10 rows from the dataframe. df_random_sample = { "count":{ "id":1039.0, "community":1039.0, "page_rank_norm":1039.0, "weight":1039.0, "x":1039.0, "y":1039.0, "twitter_profile_id":1039.0 }, "mean":{ "id":23047.0644850818, "community":11681769.4696823861, "page_rank_norm":0.0884803326, "weight":147.2675649663, "x":540.3537380859, "y":394.8444226516, "twitter_profile_id":2.008029257e+16 }, "std":{ "id":39075.4047414455, "community":6854727.7264998332, "page_rank_norm":0.1000416103, "weight":118.9822209357, "x":714.4689670341, "y":690.4519130739, "twitter_profile_id":1.345815525e+17 }, "min":{ "id":101.0, "community":2062260.0, "page_rank_norm":0.0, "weight":1.0, "x":-1367.0425072672, "y":-1543.3173448435, "twitter_profile_id":633.0 }, "25%":{ "id":467.5, "community":2062260.0, "page_rank_norm":0.0161780641, "weight":54.0, "x":8.4145058529, "y":-37.4390967754, "twitter_profile_id":17274921.5 }, "50%":{ "id":7209.0, "community":16744206.0, "page_rank_norm":0.0557416047, "weight":120.5, "x":607.9121194347, "y":394.4469887335, "twitter_profile_id":82890309.0 }, "75%":{ "id":35014.5, "community":16744206.0, "page_rank_norm":0.1264938658, "weight":215.0, "x":1100.2234176144, "y":891.8761373502, "twitter_profile_id":412977526.0 }, "max":{ "id":204406.0, "community":16744206.0, "page_rank_norm":1.0, "weight":770.5, "x":2252.6290667868, "y":2101.5421596499, "twitter_profile_id":1.086037534e+18 } } ''' The question categories are: - boolean: Valid answers include True/False, Y/N, Yes/No (all case insensitive). - category: A value from a cell (or a substring of a cell) in the dataset. - number: A numerical value from a cell in the dataset, which may represent a computed statistic (e.g., average, maximum, minimum). - list[category]: A list containing a fixed number of categories. The expected format is: "['cat', 'dog']". Pay attention to the wording of the question to determine if uniqueness is required or if repeated values are allowed. - list[number]: Similar to list[category], but with numbers as its elements. ''' # TODO: complete the following function in one line, by completing the return statement. It should give the answer to: How many rows are there in this dataframe? def example(df: pd.DataFrame): df.columns=["A"] # Expected output type: is number, this will be checked. return df.shape[0] # It should give the answer to: How many entities have a community identifier of 16744206? # The answer should only contain python code, you are not allowed leave any TODO undone. def answer(df: pd.DataFrame): # Use df to answer: How many entities have a community identifier of 16744206? df.columns = ['id', 'name', 'pic', 'is_organization', 'community', 'page_rank_norm', 'weight', 'x', 'y', 'twitter_profile_id', 'gx_link_target', 'gx_link_weight', 'gx_link_reciprocal', 'gx_link_should'] # Expected output type: is number, this will be checked. return
20250129013724
268
What is the most common name?
063_Influencers
dev
category
['name']
dev
# Instructions: Generate ONLY python code. Do not include explanations. # you can use pandas and numpy. Use the meta data information from df_schema, df_descprtion. import pandas as pd import numpy as np # Description of dataframe schema. df_schema = { "columns": [ { "name": "id", "type": "uint32" }, { "name": "name", "type": "category" }, { "name": "pic", "type": "category" }, { "name": "is_organization", "type": "bool" }, { "name": "community", "type": "uint32" }, { "name": "page_rank_norm", "type": "float64" }, { "name": "weight", "type": "float64" }, { "name": "x", "type": "float64" }, { "name": "y", "type": "float64" }, { "name": "twitter_profile_id", "type": "int64" }, { "name": "gx_link_target", "type": "object" }, { "name": "gx_link_weight", "type": "object" }, { "name": "gx_link_reciprocal", "type": "object" }, { "name": "gx_link_should", "type": "object" } ] } # Description of dataframe columns. df_descrption = { "count":{ "id":1039.0, "community":1039.0, "page_rank_norm":1039.0, "weight":1039.0, "x":1039.0, "y":1039.0, "twitter_profile_id":1039.0 }, "mean":{ "id":23047.0644850818, "community":11681769.4696823861, "page_rank_norm":0.0884803326, "weight":147.2675649663, "x":540.3537380859, "y":394.8444226516, "twitter_profile_id":2.008029257e+16 }, "std":{ "id":39075.4047414455, "community":6854727.7264998332, "page_rank_norm":0.1000416103, "weight":118.9822209357, "x":714.4689670341, "y":690.4519130739, "twitter_profile_id":1.345815525e+17 }, "min":{ "id":101.0, "community":2062260.0, "page_rank_norm":0.0, "weight":1.0, "x":-1367.0425072672, "y":-1543.3173448435, "twitter_profile_id":633.0 }, "25%":{ "id":467.5, "community":2062260.0, "page_rank_norm":0.0161780641, "weight":54.0, "x":8.4145058529, "y":-37.4390967754, "twitter_profile_id":17274921.5 }, "50%":{ "id":7209.0, "community":16744206.0, "page_rank_norm":0.0557416047, "weight":120.5, "x":607.9121194347, "y":394.4469887335, "twitter_profile_id":82890309.0 }, "75%":{ "id":35014.5, "community":16744206.0, "page_rank_norm":0.1264938658, "weight":215.0, "x":1100.2234176144, "y":891.8761373502, "twitter_profile_id":412977526.0 }, "max":{ "id":204406.0, "community":16744206.0, "page_rank_norm":1.0, "weight":770.5, "x":2252.6290667868, "y":2101.5421596499, "twitter_profile_id":1.086037534e+18 } } # Randome sample of 10 rows from the dataframe. df_random_sample = { "count":{ "id":1039.0, "community":1039.0, "page_rank_norm":1039.0, "weight":1039.0, "x":1039.0, "y":1039.0, "twitter_profile_id":1039.0 }, "mean":{ "id":23047.0644850818, "community":11681769.4696823861, "page_rank_norm":0.0884803326, "weight":147.2675649663, "x":540.3537380859, "y":394.8444226516, "twitter_profile_id":2.008029257e+16 }, "std":{ "id":39075.4047414455, "community":6854727.7264998332, "page_rank_norm":0.1000416103, "weight":118.9822209357, "x":714.4689670341, "y":690.4519130739, "twitter_profile_id":1.345815525e+17 }, "min":{ "id":101.0, "community":2062260.0, "page_rank_norm":0.0, "weight":1.0, "x":-1367.0425072672, "y":-1543.3173448435, "twitter_profile_id":633.0 }, "25%":{ "id":467.5, "community":2062260.0, "page_rank_norm":0.0161780641, "weight":54.0, "x":8.4145058529, "y":-37.4390967754, "twitter_profile_id":17274921.5 }, "50%":{ "id":7209.0, "community":16744206.0, "page_rank_norm":0.0557416047, "weight":120.5, "x":607.9121194347, "y":394.4469887335, "twitter_profile_id":82890309.0 }, "75%":{ "id":35014.5, "community":16744206.0, "page_rank_norm":0.1264938658, "weight":215.0, "x":1100.2234176144, "y":891.8761373502, "twitter_profile_id":412977526.0 }, "max":{ "id":204406.0, "community":16744206.0, "page_rank_norm":1.0, "weight":770.5, "x":2252.6290667868, "y":2101.5421596499, "twitter_profile_id":1.086037534e+18 } } ''' The question categories are: - boolean: Valid answers include True/False, Y/N, Yes/No (all case insensitive). - category: A value from a cell (or a substring of a cell) in the dataset. - number: A numerical value from a cell in the dataset, which may represent a computed statistic (e.g., average, maximum, minimum). - list[category]: A list containing a fixed number of categories. The expected format is: "['cat', 'dog']". Pay attention to the wording of the question to determine if uniqueness is required or if repeated values are allowed. - list[number]: Similar to list[category], but with numbers as its elements. ''' # TODO: complete the following function in one line, by completing the return statement. It should give the answer to: How many rows are there in this dataframe? def example(df: pd.DataFrame): df.columns=["A"] # Expected output type: is number, this will be checked. return df.shape[0] # It should give the answer to: What is the most common name? # The answer should only contain python code, you are not allowed leave any TODO undone. def answer(df: pd.DataFrame): # Use df to answer: What is the most common name? df.columns = ['id', 'name', 'pic', 'is_organization', 'community', 'page_rank_norm', 'weight', 'x', 'y', 'twitter_profile_id', 'gx_link_target', 'gx_link_weight', 'gx_link_reciprocal', 'gx_link_should'] # Expected output type: is category, this will be checked. return
20250129013724
269
Which entity has the highest page rank norm?
063_Influencers
dev
category
['name', 'page_rank_norm']
dev
# Instructions: Generate ONLY python code. Do not include explanations. # you can use pandas and numpy. Use the meta data information from df_schema, df_descprtion. import pandas as pd import numpy as np # Description of dataframe schema. df_schema = { "columns": [ { "name": "id", "type": "uint32" }, { "name": "name", "type": "category" }, { "name": "pic", "type": "category" }, { "name": "is_organization", "type": "bool" }, { "name": "community", "type": "uint32" }, { "name": "page_rank_norm", "type": "float64" }, { "name": "weight", "type": "float64" }, { "name": "x", "type": "float64" }, { "name": "y", "type": "float64" }, { "name": "twitter_profile_id", "type": "int64" }, { "name": "gx_link_target", "type": "object" }, { "name": "gx_link_weight", "type": "object" }, { "name": "gx_link_reciprocal", "type": "object" }, { "name": "gx_link_should", "type": "object" } ] } # Description of dataframe columns. df_descrption = { "count":{ "id":1039.0, "community":1039.0, "page_rank_norm":1039.0, "weight":1039.0, "x":1039.0, "y":1039.0, "twitter_profile_id":1039.0 }, "mean":{ "id":23047.0644850818, "community":11681769.4696823861, "page_rank_norm":0.0884803326, "weight":147.2675649663, "x":540.3537380859, "y":394.8444226516, "twitter_profile_id":2.008029257e+16 }, "std":{ "id":39075.4047414455, "community":6854727.7264998332, "page_rank_norm":0.1000416103, "weight":118.9822209357, "x":714.4689670341, "y":690.4519130739, "twitter_profile_id":1.345815525e+17 }, "min":{ "id":101.0, "community":2062260.0, "page_rank_norm":0.0, "weight":1.0, "x":-1367.0425072672, "y":-1543.3173448435, "twitter_profile_id":633.0 }, "25%":{ "id":467.5, "community":2062260.0, "page_rank_norm":0.0161780641, "weight":54.0, "x":8.4145058529, "y":-37.4390967754, "twitter_profile_id":17274921.5 }, "50%":{ "id":7209.0, "community":16744206.0, "page_rank_norm":0.0557416047, "weight":120.5, "x":607.9121194347, "y":394.4469887335, "twitter_profile_id":82890309.0 }, "75%":{ "id":35014.5, "community":16744206.0, "page_rank_norm":0.1264938658, "weight":215.0, "x":1100.2234176144, "y":891.8761373502, "twitter_profile_id":412977526.0 }, "max":{ "id":204406.0, "community":16744206.0, "page_rank_norm":1.0, "weight":770.5, "x":2252.6290667868, "y":2101.5421596499, "twitter_profile_id":1.086037534e+18 } } # Randome sample of 10 rows from the dataframe. df_random_sample = { "count":{ "id":1039.0, "community":1039.0, "page_rank_norm":1039.0, "weight":1039.0, "x":1039.0, "y":1039.0, "twitter_profile_id":1039.0 }, "mean":{ "id":23047.0644850818, "community":11681769.4696823861, "page_rank_norm":0.0884803326, "weight":147.2675649663, "x":540.3537380859, "y":394.8444226516, "twitter_profile_id":2.008029257e+16 }, "std":{ "id":39075.4047414455, "community":6854727.7264998332, "page_rank_norm":0.1000416103, "weight":118.9822209357, "x":714.4689670341, "y":690.4519130739, "twitter_profile_id":1.345815525e+17 }, "min":{ "id":101.0, "community":2062260.0, "page_rank_norm":0.0, "weight":1.0, "x":-1367.0425072672, "y":-1543.3173448435, "twitter_profile_id":633.0 }, "25%":{ "id":467.5, "community":2062260.0, "page_rank_norm":0.0161780641, "weight":54.0, "x":8.4145058529, "y":-37.4390967754, "twitter_profile_id":17274921.5 }, "50%":{ "id":7209.0, "community":16744206.0, "page_rank_norm":0.0557416047, "weight":120.5, "x":607.9121194347, "y":394.4469887335, "twitter_profile_id":82890309.0 }, "75%":{ "id":35014.5, "community":16744206.0, "page_rank_norm":0.1264938658, "weight":215.0, "x":1100.2234176144, "y":891.8761373502, "twitter_profile_id":412977526.0 }, "max":{ "id":204406.0, "community":16744206.0, "page_rank_norm":1.0, "weight":770.5, "x":2252.6290667868, "y":2101.5421596499, "twitter_profile_id":1.086037534e+18 } } ''' The question categories are: - boolean: Valid answers include True/False, Y/N, Yes/No (all case insensitive). - category: A value from a cell (or a substring of a cell) in the dataset. - number: A numerical value from a cell in the dataset, which may represent a computed statistic (e.g., average, maximum, minimum). - list[category]: A list containing a fixed number of categories. The expected format is: "['cat', 'dog']". Pay attention to the wording of the question to determine if uniqueness is required or if repeated values are allowed. - list[number]: Similar to list[category], but with numbers as its elements. ''' # TODO: complete the following function in one line, by completing the return statement. It should give the answer to: How many rows are there in this dataframe? def example(df: pd.DataFrame): df.columns=["A"] # Expected output type: is number, this will be checked. return df.shape[0] # It should give the answer to: Which entity has the highest page rank norm? # The answer should only contain python code, you are not allowed leave any TODO undone. def answer(df: pd.DataFrame): # Use df to answer: Which entity has the highest page rank norm? df.columns = ['id', 'name', 'pic', 'is_organization', 'community', 'page_rank_norm', 'weight', 'x', 'y', 'twitter_profile_id', 'gx_link_target', 'gx_link_weight', 'gx_link_reciprocal', 'gx_link_should'] # Expected output type: is category, this will be checked. return
20250129013724
270
What is the picture URL of the entity with the maximum weight?
063_Influencers
dev
category
['pic', 'weight']
dev
# Instructions: Generate ONLY python code. Do not include explanations. # you can use pandas and numpy. Use the meta data information from df_schema, df_descprtion. import pandas as pd import numpy as np # Description of dataframe schema. df_schema = { "columns": [ { "name": "id", "type": "uint32" }, { "name": "name", "type": "category" }, { "name": "pic", "type": "category" }, { "name": "is_organization", "type": "bool" }, { "name": "community", "type": "uint32" }, { "name": "page_rank_norm", "type": "float64" }, { "name": "weight", "type": "float64" }, { "name": "x", "type": "float64" }, { "name": "y", "type": "float64" }, { "name": "twitter_profile_id", "type": "int64" }, { "name": "gx_link_target", "type": "object" }, { "name": "gx_link_weight", "type": "object" }, { "name": "gx_link_reciprocal", "type": "object" }, { "name": "gx_link_should", "type": "object" } ] } # Description of dataframe columns. df_descrption = { "count":{ "id":1039.0, "community":1039.0, "page_rank_norm":1039.0, "weight":1039.0, "x":1039.0, "y":1039.0, "twitter_profile_id":1039.0 }, "mean":{ "id":23047.0644850818, "community":11681769.4696823861, "page_rank_norm":0.0884803326, "weight":147.2675649663, "x":540.3537380859, "y":394.8444226516, "twitter_profile_id":2.008029257e+16 }, "std":{ "id":39075.4047414455, "community":6854727.7264998332, "page_rank_norm":0.1000416103, "weight":118.9822209357, "x":714.4689670341, "y":690.4519130739, "twitter_profile_id":1.345815525e+17 }, "min":{ "id":101.0, "community":2062260.0, "page_rank_norm":0.0, "weight":1.0, "x":-1367.0425072672, "y":-1543.3173448435, "twitter_profile_id":633.0 }, "25%":{ "id":467.5, "community":2062260.0, "page_rank_norm":0.0161780641, "weight":54.0, "x":8.4145058529, "y":-37.4390967754, "twitter_profile_id":17274921.5 }, "50%":{ "id":7209.0, "community":16744206.0, "page_rank_norm":0.0557416047, "weight":120.5, "x":607.9121194347, "y":394.4469887335, "twitter_profile_id":82890309.0 }, "75%":{ "id":35014.5, "community":16744206.0, "page_rank_norm":0.1264938658, "weight":215.0, "x":1100.2234176144, "y":891.8761373502, "twitter_profile_id":412977526.0 }, "max":{ "id":204406.0, "community":16744206.0, "page_rank_norm":1.0, "weight":770.5, "x":2252.6290667868, "y":2101.5421596499, "twitter_profile_id":1.086037534e+18 } } # Randome sample of 10 rows from the dataframe. df_random_sample = { "count":{ "id":1039.0, "community":1039.0, "page_rank_norm":1039.0, "weight":1039.0, "x":1039.0, "y":1039.0, "twitter_profile_id":1039.0 }, "mean":{ "id":23047.0644850818, "community":11681769.4696823861, "page_rank_norm":0.0884803326, "weight":147.2675649663, "x":540.3537380859, "y":394.8444226516, "twitter_profile_id":2.008029257e+16 }, "std":{ "id":39075.4047414455, "community":6854727.7264998332, "page_rank_norm":0.1000416103, "weight":118.9822209357, "x":714.4689670341, "y":690.4519130739, "twitter_profile_id":1.345815525e+17 }, "min":{ "id":101.0, "community":2062260.0, "page_rank_norm":0.0, "weight":1.0, "x":-1367.0425072672, "y":-1543.3173448435, "twitter_profile_id":633.0 }, "25%":{ "id":467.5, "community":2062260.0, "page_rank_norm":0.0161780641, "weight":54.0, "x":8.4145058529, "y":-37.4390967754, "twitter_profile_id":17274921.5 }, "50%":{ "id":7209.0, "community":16744206.0, "page_rank_norm":0.0557416047, "weight":120.5, "x":607.9121194347, "y":394.4469887335, "twitter_profile_id":82890309.0 }, "75%":{ "id":35014.5, "community":16744206.0, "page_rank_norm":0.1264938658, "weight":215.0, "x":1100.2234176144, "y":891.8761373502, "twitter_profile_id":412977526.0 }, "max":{ "id":204406.0, "community":16744206.0, "page_rank_norm":1.0, "weight":770.5, "x":2252.6290667868, "y":2101.5421596499, "twitter_profile_id":1.086037534e+18 } } ''' The question categories are: - boolean: Valid answers include True/False, Y/N, Yes/No (all case insensitive). - category: A value from a cell (or a substring of a cell) in the dataset. - number: A numerical value from a cell in the dataset, which may represent a computed statistic (e.g., average, maximum, minimum). - list[category]: A list containing a fixed number of categories. The expected format is: "['cat', 'dog']". Pay attention to the wording of the question to determine if uniqueness is required or if repeated values are allowed. - list[number]: Similar to list[category], but with numbers as its elements. ''' # TODO: complete the following function in one line, by completing the return statement. It should give the answer to: How many rows are there in this dataframe? def example(df: pd.DataFrame): df.columns=["A"] # Expected output type: is number, this will be checked. return df.shape[0] # It should give the answer to: What is the picture URL of the entity with the maximum weight? # The answer should only contain python code, you are not allowed leave any TODO undone. def answer(df: pd.DataFrame): # Use df to answer: What is the picture URL of the entity with the maximum weight? df.columns = ['id', 'name', 'pic', 'is_organization', 'community', 'page_rank_norm', 'weight', 'x', 'y', 'twitter_profile_id', 'gx_link_target', 'gx_link_weight', 'gx_link_reciprocal', 'gx_link_should'] # Expected output type: is category, this will be checked. return
20250129013724
271
Which entity has the highest y-coordinate?
063_Influencers
dev
category
['name', 'y']
dev
# Instructions: Generate ONLY python code. Do not include explanations. # you can use pandas and numpy. Use the meta data information from df_schema, df_descprtion. import pandas as pd import numpy as np # Description of dataframe schema. df_schema = { "columns": [ { "name": "id", "type": "uint32" }, { "name": "name", "type": "category" }, { "name": "pic", "type": "category" }, { "name": "is_organization", "type": "bool" }, { "name": "community", "type": "uint32" }, { "name": "page_rank_norm", "type": "float64" }, { "name": "weight", "type": "float64" }, { "name": "x", "type": "float64" }, { "name": "y", "type": "float64" }, { "name": "twitter_profile_id", "type": "int64" }, { "name": "gx_link_target", "type": "object" }, { "name": "gx_link_weight", "type": "object" }, { "name": "gx_link_reciprocal", "type": "object" }, { "name": "gx_link_should", "type": "object" } ] } # Description of dataframe columns. df_descrption = { "count":{ "id":1039.0, "community":1039.0, "page_rank_norm":1039.0, "weight":1039.0, "x":1039.0, "y":1039.0, "twitter_profile_id":1039.0 }, "mean":{ "id":23047.0644850818, "community":11681769.4696823861, "page_rank_norm":0.0884803326, "weight":147.2675649663, "x":540.3537380859, "y":394.8444226516, "twitter_profile_id":2.008029257e+16 }, "std":{ "id":39075.4047414455, "community":6854727.7264998332, "page_rank_norm":0.1000416103, "weight":118.9822209357, "x":714.4689670341, "y":690.4519130739, "twitter_profile_id":1.345815525e+17 }, "min":{ "id":101.0, "community":2062260.0, "page_rank_norm":0.0, "weight":1.0, "x":-1367.0425072672, "y":-1543.3173448435, "twitter_profile_id":633.0 }, "25%":{ "id":467.5, "community":2062260.0, "page_rank_norm":0.0161780641, "weight":54.0, "x":8.4145058529, "y":-37.4390967754, "twitter_profile_id":17274921.5 }, "50%":{ "id":7209.0, "community":16744206.0, "page_rank_norm":0.0557416047, "weight":120.5, "x":607.9121194347, "y":394.4469887335, "twitter_profile_id":82890309.0 }, "75%":{ "id":35014.5, "community":16744206.0, "page_rank_norm":0.1264938658, "weight":215.0, "x":1100.2234176144, "y":891.8761373502, "twitter_profile_id":412977526.0 }, "max":{ "id":204406.0, "community":16744206.0, "page_rank_norm":1.0, "weight":770.5, "x":2252.6290667868, "y":2101.5421596499, "twitter_profile_id":1.086037534e+18 } } # Randome sample of 10 rows from the dataframe. df_random_sample = { "count":{ "id":1039.0, "community":1039.0, "page_rank_norm":1039.0, "weight":1039.0, "x":1039.0, "y":1039.0, "twitter_profile_id":1039.0 }, "mean":{ "id":23047.0644850818, "community":11681769.4696823861, "page_rank_norm":0.0884803326, "weight":147.2675649663, "x":540.3537380859, "y":394.8444226516, "twitter_profile_id":2.008029257e+16 }, "std":{ "id":39075.4047414455, "community":6854727.7264998332, "page_rank_norm":0.1000416103, "weight":118.9822209357, "x":714.4689670341, "y":690.4519130739, "twitter_profile_id":1.345815525e+17 }, "min":{ "id":101.0, "community":2062260.0, "page_rank_norm":0.0, "weight":1.0, "x":-1367.0425072672, "y":-1543.3173448435, "twitter_profile_id":633.0 }, "25%":{ "id":467.5, "community":2062260.0, "page_rank_norm":0.0161780641, "weight":54.0, "x":8.4145058529, "y":-37.4390967754, "twitter_profile_id":17274921.5 }, "50%":{ "id":7209.0, "community":16744206.0, "page_rank_norm":0.0557416047, "weight":120.5, "x":607.9121194347, "y":394.4469887335, "twitter_profile_id":82890309.0 }, "75%":{ "id":35014.5, "community":16744206.0, "page_rank_norm":0.1264938658, "weight":215.0, "x":1100.2234176144, "y":891.8761373502, "twitter_profile_id":412977526.0 }, "max":{ "id":204406.0, "community":16744206.0, "page_rank_norm":1.0, "weight":770.5, "x":2252.6290667868, "y":2101.5421596499, "twitter_profile_id":1.086037534e+18 } } ''' The question categories are: - boolean: Valid answers include True/False, Y/N, Yes/No (all case insensitive). - category: A value from a cell (or a substring of a cell) in the dataset. - number: A numerical value from a cell in the dataset, which may represent a computed statistic (e.g., average, maximum, minimum). - list[category]: A list containing a fixed number of categories. The expected format is: "['cat', 'dog']". Pay attention to the wording of the question to determine if uniqueness is required or if repeated values are allowed. - list[number]: Similar to list[category], but with numbers as its elements. ''' # TODO: complete the following function in one line, by completing the return statement. It should give the answer to: How many rows are there in this dataframe? def example(df: pd.DataFrame): df.columns=["A"] # Expected output type: is number, this will be checked. return df.shape[0] # It should give the answer to: Which entity has the highest y-coordinate? # The answer should only contain python code, you are not allowed leave any TODO undone. def answer(df: pd.DataFrame): # Use df to answer: Which entity has the highest y-coordinate? df.columns = ['id', 'name', 'pic', 'is_organization', 'community', 'page_rank_norm', 'weight', 'x', 'y', 'twitter_profile_id', 'gx_link_target', 'gx_link_weight', 'gx_link_reciprocal', 'gx_link_should'] # Expected output type: is category, this will be checked. return
20250129013724
272
What are the top 3 entity names with the highest weights?
063_Influencers
dev
list[category]
['name', 'weight']
dev
# Instructions: Generate ONLY python code. Do not include explanations. # you can use pandas and numpy. Use the meta data information from df_schema, df_descprtion. import pandas as pd import numpy as np # Description of dataframe schema. df_schema = { "columns": [ { "name": "id", "type": "uint32" }, { "name": "name", "type": "category" }, { "name": "pic", "type": "category" }, { "name": "is_organization", "type": "bool" }, { "name": "community", "type": "uint32" }, { "name": "page_rank_norm", "type": "float64" }, { "name": "weight", "type": "float64" }, { "name": "x", "type": "float64" }, { "name": "y", "type": "float64" }, { "name": "twitter_profile_id", "type": "int64" }, { "name": "gx_link_target", "type": "object" }, { "name": "gx_link_weight", "type": "object" }, { "name": "gx_link_reciprocal", "type": "object" }, { "name": "gx_link_should", "type": "object" } ] } # Description of dataframe columns. df_descrption = { "count":{ "id":1039.0, "community":1039.0, "page_rank_norm":1039.0, "weight":1039.0, "x":1039.0, "y":1039.0, "twitter_profile_id":1039.0 }, "mean":{ "id":23047.0644850818, "community":11681769.4696823861, "page_rank_norm":0.0884803326, "weight":147.2675649663, "x":540.3537380859, "y":394.8444226516, "twitter_profile_id":2.008029257e+16 }, "std":{ "id":39075.4047414455, "community":6854727.7264998332, "page_rank_norm":0.1000416103, "weight":118.9822209357, "x":714.4689670341, "y":690.4519130739, "twitter_profile_id":1.345815525e+17 }, "min":{ "id":101.0, "community":2062260.0, "page_rank_norm":0.0, "weight":1.0, "x":-1367.0425072672, "y":-1543.3173448435, "twitter_profile_id":633.0 }, "25%":{ "id":467.5, "community":2062260.0, "page_rank_norm":0.0161780641, "weight":54.0, "x":8.4145058529, "y":-37.4390967754, "twitter_profile_id":17274921.5 }, "50%":{ "id":7209.0, "community":16744206.0, "page_rank_norm":0.0557416047, "weight":120.5, "x":607.9121194347, "y":394.4469887335, "twitter_profile_id":82890309.0 }, "75%":{ "id":35014.5, "community":16744206.0, "page_rank_norm":0.1264938658, "weight":215.0, "x":1100.2234176144, "y":891.8761373502, "twitter_profile_id":412977526.0 }, "max":{ "id":204406.0, "community":16744206.0, "page_rank_norm":1.0, "weight":770.5, "x":2252.6290667868, "y":2101.5421596499, "twitter_profile_id":1.086037534e+18 } } # Randome sample of 10 rows from the dataframe. df_random_sample = { "count":{ "id":1039.0, "community":1039.0, "page_rank_norm":1039.0, "weight":1039.0, "x":1039.0, "y":1039.0, "twitter_profile_id":1039.0 }, "mean":{ "id":23047.0644850818, "community":11681769.4696823861, "page_rank_norm":0.0884803326, "weight":147.2675649663, "x":540.3537380859, "y":394.8444226516, "twitter_profile_id":2.008029257e+16 }, "std":{ "id":39075.4047414455, "community":6854727.7264998332, "page_rank_norm":0.1000416103, "weight":118.9822209357, "x":714.4689670341, "y":690.4519130739, "twitter_profile_id":1.345815525e+17 }, "min":{ "id":101.0, "community":2062260.0, "page_rank_norm":0.0, "weight":1.0, "x":-1367.0425072672, "y":-1543.3173448435, "twitter_profile_id":633.0 }, "25%":{ "id":467.5, "community":2062260.0, "page_rank_norm":0.0161780641, "weight":54.0, "x":8.4145058529, "y":-37.4390967754, "twitter_profile_id":17274921.5 }, "50%":{ "id":7209.0, "community":16744206.0, "page_rank_norm":0.0557416047, "weight":120.5, "x":607.9121194347, "y":394.4469887335, "twitter_profile_id":82890309.0 }, "75%":{ "id":35014.5, "community":16744206.0, "page_rank_norm":0.1264938658, "weight":215.0, "x":1100.2234176144, "y":891.8761373502, "twitter_profile_id":412977526.0 }, "max":{ "id":204406.0, "community":16744206.0, "page_rank_norm":1.0, "weight":770.5, "x":2252.6290667868, "y":2101.5421596499, "twitter_profile_id":1.086037534e+18 } } ''' The question categories are: - boolean: Valid answers include True/False, Y/N, Yes/No (all case insensitive). - category: A value from a cell (or a substring of a cell) in the dataset. - number: A numerical value from a cell in the dataset, which may represent a computed statistic (e.g., average, maximum, minimum). - list[category]: A list containing a fixed number of categories. The expected format is: "['cat', 'dog']". Pay attention to the wording of the question to determine if uniqueness is required or if repeated values are allowed. - list[number]: Similar to list[category], but with numbers as its elements. ''' # TODO: complete the following function in one line, by completing the return statement. It should give the answer to: How many rows are there in this dataframe? def example(df: pd.DataFrame): df.columns=["A"] # Expected output type: is number, this will be checked. return df.shape[0] # It should give the answer to: What are the top 3 entity names with the highest weights? # The answer should only contain python code, you are not allowed leave any TODO undone. def answer(df: pd.DataFrame): # Use df to answer: What are the top 3 entity names with the highest weights? df.columns = ['id', 'name', 'pic', 'is_organization', 'community', 'page_rank_norm', 'weight', 'x', 'y', 'twitter_profile_id', 'gx_link_target', 'gx_link_weight', 'gx_link_reciprocal', 'gx_link_should'] # Expected output type: is list[category], this will be checked. return
20250129013724
273
What are the bottom 2 entities in terms of page rank norm?
063_Influencers
dev
list[category]
['name', 'page_rank_norm']
dev
# Instructions: Generate ONLY python code. Do not include explanations. # you can use pandas and numpy. Use the meta data information from df_schema, df_descprtion. import pandas as pd import numpy as np # Description of dataframe schema. df_schema = { "columns": [ { "name": "id", "type": "uint32" }, { "name": "name", "type": "category" }, { "name": "pic", "type": "category" }, { "name": "is_organization", "type": "bool" }, { "name": "community", "type": "uint32" }, { "name": "page_rank_norm", "type": "float64" }, { "name": "weight", "type": "float64" }, { "name": "x", "type": "float64" }, { "name": "y", "type": "float64" }, { "name": "twitter_profile_id", "type": "int64" }, { "name": "gx_link_target", "type": "object" }, { "name": "gx_link_weight", "type": "object" }, { "name": "gx_link_reciprocal", "type": "object" }, { "name": "gx_link_should", "type": "object" } ] } # Description of dataframe columns. df_descrption = { "count":{ "id":1039.0, "community":1039.0, "page_rank_norm":1039.0, "weight":1039.0, "x":1039.0, "y":1039.0, "twitter_profile_id":1039.0 }, "mean":{ "id":23047.0644850818, "community":11681769.4696823861, "page_rank_norm":0.0884803326, "weight":147.2675649663, "x":540.3537380859, "y":394.8444226516, "twitter_profile_id":2.008029257e+16 }, "std":{ "id":39075.4047414455, "community":6854727.7264998332, "page_rank_norm":0.1000416103, "weight":118.9822209357, "x":714.4689670341, "y":690.4519130739, "twitter_profile_id":1.345815525e+17 }, "min":{ "id":101.0, "community":2062260.0, "page_rank_norm":0.0, "weight":1.0, "x":-1367.0425072672, "y":-1543.3173448435, "twitter_profile_id":633.0 }, "25%":{ "id":467.5, "community":2062260.0, "page_rank_norm":0.0161780641, "weight":54.0, "x":8.4145058529, "y":-37.4390967754, "twitter_profile_id":17274921.5 }, "50%":{ "id":7209.0, "community":16744206.0, "page_rank_norm":0.0557416047, "weight":120.5, "x":607.9121194347, "y":394.4469887335, "twitter_profile_id":82890309.0 }, "75%":{ "id":35014.5, "community":16744206.0, "page_rank_norm":0.1264938658, "weight":215.0, "x":1100.2234176144, "y":891.8761373502, "twitter_profile_id":412977526.0 }, "max":{ "id":204406.0, "community":16744206.0, "page_rank_norm":1.0, "weight":770.5, "x":2252.6290667868, "y":2101.5421596499, "twitter_profile_id":1.086037534e+18 } } # Randome sample of 10 rows from the dataframe. df_random_sample = { "count":{ "id":1039.0, "community":1039.0, "page_rank_norm":1039.0, "weight":1039.0, "x":1039.0, "y":1039.0, "twitter_profile_id":1039.0 }, "mean":{ "id":23047.0644850818, "community":11681769.4696823861, "page_rank_norm":0.0884803326, "weight":147.2675649663, "x":540.3537380859, "y":394.8444226516, "twitter_profile_id":2.008029257e+16 }, "std":{ "id":39075.4047414455, "community":6854727.7264998332, "page_rank_norm":0.1000416103, "weight":118.9822209357, "x":714.4689670341, "y":690.4519130739, "twitter_profile_id":1.345815525e+17 }, "min":{ "id":101.0, "community":2062260.0, "page_rank_norm":0.0, "weight":1.0, "x":-1367.0425072672, "y":-1543.3173448435, "twitter_profile_id":633.0 }, "25%":{ "id":467.5, "community":2062260.0, "page_rank_norm":0.0161780641, "weight":54.0, "x":8.4145058529, "y":-37.4390967754, "twitter_profile_id":17274921.5 }, "50%":{ "id":7209.0, "community":16744206.0, "page_rank_norm":0.0557416047, "weight":120.5, "x":607.9121194347, "y":394.4469887335, "twitter_profile_id":82890309.0 }, "75%":{ "id":35014.5, "community":16744206.0, "page_rank_norm":0.1264938658, "weight":215.0, "x":1100.2234176144, "y":891.8761373502, "twitter_profile_id":412977526.0 }, "max":{ "id":204406.0, "community":16744206.0, "page_rank_norm":1.0, "weight":770.5, "x":2252.6290667868, "y":2101.5421596499, "twitter_profile_id":1.086037534e+18 } } ''' The question categories are: - boolean: Valid answers include True/False, Y/N, Yes/No (all case insensitive). - category: A value from a cell (or a substring of a cell) in the dataset. - number: A numerical value from a cell in the dataset, which may represent a computed statistic (e.g., average, maximum, minimum). - list[category]: A list containing a fixed number of categories. The expected format is: "['cat', 'dog']". Pay attention to the wording of the question to determine if uniqueness is required or if repeated values are allowed. - list[number]: Similar to list[category], but with numbers as its elements. ''' # TODO: complete the following function in one line, by completing the return statement. It should give the answer to: How many rows are there in this dataframe? def example(df: pd.DataFrame): df.columns=["A"] # Expected output type: is number, this will be checked. return df.shape[0] # It should give the answer to: What are the bottom 2 entities in terms of page rank norm? # The answer should only contain python code, you are not allowed leave any TODO undone. def answer(df: pd.DataFrame): # Use df to answer: What are the bottom 2 entities in terms of page rank norm? df.columns = ['id', 'name', 'pic', 'is_organization', 'community', 'page_rank_norm', 'weight', 'x', 'y', 'twitter_profile_id', 'gx_link_target', 'gx_link_weight', 'gx_link_reciprocal', 'gx_link_should'] # Expected output type: is list[category], this will be checked. return
20250129013725
274
What are the top 4 entities with the highest x-coordinates?
063_Influencers
dev
list[category]
['name', 'x']
dev
# Instructions: Generate ONLY python code. Do not include explanations. # you can use pandas and numpy. Use the meta data information from df_schema, df_descprtion. import pandas as pd import numpy as np # Description of dataframe schema. df_schema = { "columns": [ { "name": "id", "type": "uint32" }, { "name": "name", "type": "category" }, { "name": "pic", "type": "category" }, { "name": "is_organization", "type": "bool" }, { "name": "community", "type": "uint32" }, { "name": "page_rank_norm", "type": "float64" }, { "name": "weight", "type": "float64" }, { "name": "x", "type": "float64" }, { "name": "y", "type": "float64" }, { "name": "twitter_profile_id", "type": "int64" }, { "name": "gx_link_target", "type": "object" }, { "name": "gx_link_weight", "type": "object" }, { "name": "gx_link_reciprocal", "type": "object" }, { "name": "gx_link_should", "type": "object" } ] } # Description of dataframe columns. df_descrption = { "count":{ "id":1039.0, "community":1039.0, "page_rank_norm":1039.0, "weight":1039.0, "x":1039.0, "y":1039.0, "twitter_profile_id":1039.0 }, "mean":{ "id":23047.0644850818, "community":11681769.4696823861, "page_rank_norm":0.0884803326, "weight":147.2675649663, "x":540.3537380859, "y":394.8444226516, "twitter_profile_id":2.008029257e+16 }, "std":{ "id":39075.4047414455, "community":6854727.7264998332, "page_rank_norm":0.1000416103, "weight":118.9822209357, "x":714.4689670341, "y":690.4519130739, "twitter_profile_id":1.345815525e+17 }, "min":{ "id":101.0, "community":2062260.0, "page_rank_norm":0.0, "weight":1.0, "x":-1367.0425072672, "y":-1543.3173448435, "twitter_profile_id":633.0 }, "25%":{ "id":467.5, "community":2062260.0, "page_rank_norm":0.0161780641, "weight":54.0, "x":8.4145058529, "y":-37.4390967754, "twitter_profile_id":17274921.5 }, "50%":{ "id":7209.0, "community":16744206.0, "page_rank_norm":0.0557416047, "weight":120.5, "x":607.9121194347, "y":394.4469887335, "twitter_profile_id":82890309.0 }, "75%":{ "id":35014.5, "community":16744206.0, "page_rank_norm":0.1264938658, "weight":215.0, "x":1100.2234176144, "y":891.8761373502, "twitter_profile_id":412977526.0 }, "max":{ "id":204406.0, "community":16744206.0, "page_rank_norm":1.0, "weight":770.5, "x":2252.6290667868, "y":2101.5421596499, "twitter_profile_id":1.086037534e+18 } } # Randome sample of 10 rows from the dataframe. df_random_sample = { "count":{ "id":1039.0, "community":1039.0, "page_rank_norm":1039.0, "weight":1039.0, "x":1039.0, "y":1039.0, "twitter_profile_id":1039.0 }, "mean":{ "id":23047.0644850818, "community":11681769.4696823861, "page_rank_norm":0.0884803326, "weight":147.2675649663, "x":540.3537380859, "y":394.8444226516, "twitter_profile_id":2.008029257e+16 }, "std":{ "id":39075.4047414455, "community":6854727.7264998332, "page_rank_norm":0.1000416103, "weight":118.9822209357, "x":714.4689670341, "y":690.4519130739, "twitter_profile_id":1.345815525e+17 }, "min":{ "id":101.0, "community":2062260.0, "page_rank_norm":0.0, "weight":1.0, "x":-1367.0425072672, "y":-1543.3173448435, "twitter_profile_id":633.0 }, "25%":{ "id":467.5, "community":2062260.0, "page_rank_norm":0.0161780641, "weight":54.0, "x":8.4145058529, "y":-37.4390967754, "twitter_profile_id":17274921.5 }, "50%":{ "id":7209.0, "community":16744206.0, "page_rank_norm":0.0557416047, "weight":120.5, "x":607.9121194347, "y":394.4469887335, "twitter_profile_id":82890309.0 }, "75%":{ "id":35014.5, "community":16744206.0, "page_rank_norm":0.1264938658, "weight":215.0, "x":1100.2234176144, "y":891.8761373502, "twitter_profile_id":412977526.0 }, "max":{ "id":204406.0, "community":16744206.0, "page_rank_norm":1.0, "weight":770.5, "x":2252.6290667868, "y":2101.5421596499, "twitter_profile_id":1.086037534e+18 } } ''' The question categories are: - boolean: Valid answers include True/False, Y/N, Yes/No (all case insensitive). - category: A value from a cell (or a substring of a cell) in the dataset. - number: A numerical value from a cell in the dataset, which may represent a computed statistic (e.g., average, maximum, minimum). - list[category]: A list containing a fixed number of categories. The expected format is: "['cat', 'dog']". Pay attention to the wording of the question to determine if uniqueness is required or if repeated values are allowed. - list[number]: Similar to list[category], but with numbers as its elements. ''' # TODO: complete the following function in one line, by completing the return statement. It should give the answer to: How many rows are there in this dataframe? def example(df: pd.DataFrame): df.columns=["A"] # Expected output type: is number, this will be checked. return df.shape[0] # It should give the answer to: What are the top 4 entities with the highest x-coordinates? # The answer should only contain python code, you are not allowed leave any TODO undone. def answer(df: pd.DataFrame): # Use df to answer: What are the top 4 entities with the highest x-coordinates? df.columns = ['id', 'name', 'pic', 'is_organization', 'community', 'page_rank_norm', 'weight', 'x', 'y', 'twitter_profile_id', 'gx_link_target', 'gx_link_weight', 'gx_link_reciprocal', 'gx_link_should'] # Expected output type: is list[category], this will be checked. return
20250129013725
275
What are the bottom 3 entities in terms of y-coordinates?
063_Influencers
dev
list[category]
['name', 'y']
dev
# Instructions: Generate ONLY python code. Do not include explanations. # you can use pandas and numpy. Use the meta data information from df_schema, df_descprtion. import pandas as pd import numpy as np # Description of dataframe schema. df_schema = { "columns": [ { "name": "id", "type": "uint32" }, { "name": "name", "type": "category" }, { "name": "pic", "type": "category" }, { "name": "is_organization", "type": "bool" }, { "name": "community", "type": "uint32" }, { "name": "page_rank_norm", "type": "float64" }, { "name": "weight", "type": "float64" }, { "name": "x", "type": "float64" }, { "name": "y", "type": "float64" }, { "name": "twitter_profile_id", "type": "int64" }, { "name": "gx_link_target", "type": "object" }, { "name": "gx_link_weight", "type": "object" }, { "name": "gx_link_reciprocal", "type": "object" }, { "name": "gx_link_should", "type": "object" } ] } # Description of dataframe columns. df_descrption = { "count":{ "id":1039.0, "community":1039.0, "page_rank_norm":1039.0, "weight":1039.0, "x":1039.0, "y":1039.0, "twitter_profile_id":1039.0 }, "mean":{ "id":23047.0644850818, "community":11681769.4696823861, "page_rank_norm":0.0884803326, "weight":147.2675649663, "x":540.3537380859, "y":394.8444226516, "twitter_profile_id":2.008029257e+16 }, "std":{ "id":39075.4047414455, "community":6854727.7264998332, "page_rank_norm":0.1000416103, "weight":118.9822209357, "x":714.4689670341, "y":690.4519130739, "twitter_profile_id":1.345815525e+17 }, "min":{ "id":101.0, "community":2062260.0, "page_rank_norm":0.0, "weight":1.0, "x":-1367.0425072672, "y":-1543.3173448435, "twitter_profile_id":633.0 }, "25%":{ "id":467.5, "community":2062260.0, "page_rank_norm":0.0161780641, "weight":54.0, "x":8.4145058529, "y":-37.4390967754, "twitter_profile_id":17274921.5 }, "50%":{ "id":7209.0, "community":16744206.0, "page_rank_norm":0.0557416047, "weight":120.5, "x":607.9121194347, "y":394.4469887335, "twitter_profile_id":82890309.0 }, "75%":{ "id":35014.5, "community":16744206.0, "page_rank_norm":0.1264938658, "weight":215.0, "x":1100.2234176144, "y":891.8761373502, "twitter_profile_id":412977526.0 }, "max":{ "id":204406.0, "community":16744206.0, "page_rank_norm":1.0, "weight":770.5, "x":2252.6290667868, "y":2101.5421596499, "twitter_profile_id":1.086037534e+18 } } # Randome sample of 10 rows from the dataframe. df_random_sample = { "count":{ "id":1039.0, "community":1039.0, "page_rank_norm":1039.0, "weight":1039.0, "x":1039.0, "y":1039.0, "twitter_profile_id":1039.0 }, "mean":{ "id":23047.0644850818, "community":11681769.4696823861, "page_rank_norm":0.0884803326, "weight":147.2675649663, "x":540.3537380859, "y":394.8444226516, "twitter_profile_id":2.008029257e+16 }, "std":{ "id":39075.4047414455, "community":6854727.7264998332, "page_rank_norm":0.1000416103, "weight":118.9822209357, "x":714.4689670341, "y":690.4519130739, "twitter_profile_id":1.345815525e+17 }, "min":{ "id":101.0, "community":2062260.0, "page_rank_norm":0.0, "weight":1.0, "x":-1367.0425072672, "y":-1543.3173448435, "twitter_profile_id":633.0 }, "25%":{ "id":467.5, "community":2062260.0, "page_rank_norm":0.0161780641, "weight":54.0, "x":8.4145058529, "y":-37.4390967754, "twitter_profile_id":17274921.5 }, "50%":{ "id":7209.0, "community":16744206.0, "page_rank_norm":0.0557416047, "weight":120.5, "x":607.9121194347, "y":394.4469887335, "twitter_profile_id":82890309.0 }, "75%":{ "id":35014.5, "community":16744206.0, "page_rank_norm":0.1264938658, "weight":215.0, "x":1100.2234176144, "y":891.8761373502, "twitter_profile_id":412977526.0 }, "max":{ "id":204406.0, "community":16744206.0, "page_rank_norm":1.0, "weight":770.5, "x":2252.6290667868, "y":2101.5421596499, "twitter_profile_id":1.086037534e+18 } } ''' The question categories are: - boolean: Valid answers include True/False, Y/N, Yes/No (all case insensitive). - category: A value from a cell (or a substring of a cell) in the dataset. - number: A numerical value from a cell in the dataset, which may represent a computed statistic (e.g., average, maximum, minimum). - list[category]: A list containing a fixed number of categories. The expected format is: "['cat', 'dog']". Pay attention to the wording of the question to determine if uniqueness is required or if repeated values are allowed. - list[number]: Similar to list[category], but with numbers as its elements. ''' # TODO: complete the following function in one line, by completing the return statement. It should give the answer to: How many rows are there in this dataframe? def example(df: pd.DataFrame): df.columns=["A"] # Expected output type: is number, this will be checked. return df.shape[0] # It should give the answer to: What are the bottom 3 entities in terms of y-coordinates? # The answer should only contain python code, you are not allowed leave any TODO undone. def answer(df: pd.DataFrame): # Use df to answer: What are the bottom 3 entities in terms of y-coordinates? df.columns = ['id', 'name', 'pic', 'is_organization', 'community', 'page_rank_norm', 'weight', 'x', 'y', 'twitter_profile_id', 'gx_link_target', 'gx_link_weight', 'gx_link_reciprocal', 'gx_link_should'] # Expected output type: is list[category], this will be checked. return
20250129013725
276
What are the top 5 entity IDs in terms of weight?
063_Influencers
dev
list[number]
['id', 'weight']
dev
# Instructions: Generate ONLY python code. Do not include explanations. # you can use pandas and numpy. Use the meta data information from df_schema, df_descprtion. import pandas as pd import numpy as np # Description of dataframe schema. df_schema = { "columns": [ { "name": "id", "type": "uint32" }, { "name": "name", "type": "category" }, { "name": "pic", "type": "category" }, { "name": "is_organization", "type": "bool" }, { "name": "community", "type": "uint32" }, { "name": "page_rank_norm", "type": "float64" }, { "name": "weight", "type": "float64" }, { "name": "x", "type": "float64" }, { "name": "y", "type": "float64" }, { "name": "twitter_profile_id", "type": "int64" }, { "name": "gx_link_target", "type": "object" }, { "name": "gx_link_weight", "type": "object" }, { "name": "gx_link_reciprocal", "type": "object" }, { "name": "gx_link_should", "type": "object" } ] } # Description of dataframe columns. df_descrption = { "count":{ "id":1039.0, "community":1039.0, "page_rank_norm":1039.0, "weight":1039.0, "x":1039.0, "y":1039.0, "twitter_profile_id":1039.0 }, "mean":{ "id":23047.0644850818, "community":11681769.4696823861, "page_rank_norm":0.0884803326, "weight":147.2675649663, "x":540.3537380859, "y":394.8444226516, "twitter_profile_id":2.008029257e+16 }, "std":{ "id":39075.4047414455, "community":6854727.7264998332, "page_rank_norm":0.1000416103, "weight":118.9822209357, "x":714.4689670341, "y":690.4519130739, "twitter_profile_id":1.345815525e+17 }, "min":{ "id":101.0, "community":2062260.0, "page_rank_norm":0.0, "weight":1.0, "x":-1367.0425072672, "y":-1543.3173448435, "twitter_profile_id":633.0 }, "25%":{ "id":467.5, "community":2062260.0, "page_rank_norm":0.0161780641, "weight":54.0, "x":8.4145058529, "y":-37.4390967754, "twitter_profile_id":17274921.5 }, "50%":{ "id":7209.0, "community":16744206.0, "page_rank_norm":0.0557416047, "weight":120.5, "x":607.9121194347, "y":394.4469887335, "twitter_profile_id":82890309.0 }, "75%":{ "id":35014.5, "community":16744206.0, "page_rank_norm":0.1264938658, "weight":215.0, "x":1100.2234176144, "y":891.8761373502, "twitter_profile_id":412977526.0 }, "max":{ "id":204406.0, "community":16744206.0, "page_rank_norm":1.0, "weight":770.5, "x":2252.6290667868, "y":2101.5421596499, "twitter_profile_id":1.086037534e+18 } } # Randome sample of 10 rows from the dataframe. df_random_sample = { "count":{ "id":1039.0, "community":1039.0, "page_rank_norm":1039.0, "weight":1039.0, "x":1039.0, "y":1039.0, "twitter_profile_id":1039.0 }, "mean":{ "id":23047.0644850818, "community":11681769.4696823861, "page_rank_norm":0.0884803326, "weight":147.2675649663, "x":540.3537380859, "y":394.8444226516, "twitter_profile_id":2.008029257e+16 }, "std":{ "id":39075.4047414455, "community":6854727.7264998332, "page_rank_norm":0.1000416103, "weight":118.9822209357, "x":714.4689670341, "y":690.4519130739, "twitter_profile_id":1.345815525e+17 }, "min":{ "id":101.0, "community":2062260.0, "page_rank_norm":0.0, "weight":1.0, "x":-1367.0425072672, "y":-1543.3173448435, "twitter_profile_id":633.0 }, "25%":{ "id":467.5, "community":2062260.0, "page_rank_norm":0.0161780641, "weight":54.0, "x":8.4145058529, "y":-37.4390967754, "twitter_profile_id":17274921.5 }, "50%":{ "id":7209.0, "community":16744206.0, "page_rank_norm":0.0557416047, "weight":120.5, "x":607.9121194347, "y":394.4469887335, "twitter_profile_id":82890309.0 }, "75%":{ "id":35014.5, "community":16744206.0, "page_rank_norm":0.1264938658, "weight":215.0, "x":1100.2234176144, "y":891.8761373502, "twitter_profile_id":412977526.0 }, "max":{ "id":204406.0, "community":16744206.0, "page_rank_norm":1.0, "weight":770.5, "x":2252.6290667868, "y":2101.5421596499, "twitter_profile_id":1.086037534e+18 } } ''' The question categories are: - boolean: Valid answers include True/False, Y/N, Yes/No (all case insensitive). - category: A value from a cell (or a substring of a cell) in the dataset. - number: A numerical value from a cell in the dataset, which may represent a computed statistic (e.g., average, maximum, minimum). - list[category]: A list containing a fixed number of categories. The expected format is: "['cat', 'dog']". Pay attention to the wording of the question to determine if uniqueness is required or if repeated values are allowed. - list[number]: Similar to list[category], but with numbers as its elements. ''' # TODO: complete the following function in one line, by completing the return statement. It should give the answer to: How many rows are there in this dataframe? def example(df: pd.DataFrame): df.columns=["A"] # Expected output type: is number, this will be checked. return df.shape[0] # It should give the answer to: What are the top 5 entity IDs in terms of weight? # The answer should only contain python code, you are not allowed leave any TODO undone. def answer(df: pd.DataFrame): # Use df to answer: What are the top 5 entity IDs in terms of weight? df.columns = ['id', 'name', 'pic', 'is_organization', 'community', 'page_rank_norm', 'weight', 'x', 'y', 'twitter_profile_id', 'gx_link_target', 'gx_link_weight', 'gx_link_reciprocal', 'gx_link_should'] # Expected output type: is list[number], this will be checked. return
20250129013725
277
What are the bottom 4 entity IDs in terms of page rank norm?
063_Influencers
dev
list[number]
['id', 'page_rank_norm']
dev
# Instructions: Generate ONLY python code. Do not include explanations. # you can use pandas and numpy. Use the meta data information from df_schema, df_descprtion. import pandas as pd import numpy as np # Description of dataframe schema. df_schema = { "columns": [ { "name": "id", "type": "uint32" }, { "name": "name", "type": "category" }, { "name": "pic", "type": "category" }, { "name": "is_organization", "type": "bool" }, { "name": "community", "type": "uint32" }, { "name": "page_rank_norm", "type": "float64" }, { "name": "weight", "type": "float64" }, { "name": "x", "type": "float64" }, { "name": "y", "type": "float64" }, { "name": "twitter_profile_id", "type": "int64" }, { "name": "gx_link_target", "type": "object" }, { "name": "gx_link_weight", "type": "object" }, { "name": "gx_link_reciprocal", "type": "object" }, { "name": "gx_link_should", "type": "object" } ] } # Description of dataframe columns. df_descrption = { "count":{ "id":1039.0, "community":1039.0, "page_rank_norm":1039.0, "weight":1039.0, "x":1039.0, "y":1039.0, "twitter_profile_id":1039.0 }, "mean":{ "id":23047.0644850818, "community":11681769.4696823861, "page_rank_norm":0.0884803326, "weight":147.2675649663, "x":540.3537380859, "y":394.8444226516, "twitter_profile_id":2.008029257e+16 }, "std":{ "id":39075.4047414455, "community":6854727.7264998332, "page_rank_norm":0.1000416103, "weight":118.9822209357, "x":714.4689670341, "y":690.4519130739, "twitter_profile_id":1.345815525e+17 }, "min":{ "id":101.0, "community":2062260.0, "page_rank_norm":0.0, "weight":1.0, "x":-1367.0425072672, "y":-1543.3173448435, "twitter_profile_id":633.0 }, "25%":{ "id":467.5, "community":2062260.0, "page_rank_norm":0.0161780641, "weight":54.0, "x":8.4145058529, "y":-37.4390967754, "twitter_profile_id":17274921.5 }, "50%":{ "id":7209.0, "community":16744206.0, "page_rank_norm":0.0557416047, "weight":120.5, "x":607.9121194347, "y":394.4469887335, "twitter_profile_id":82890309.0 }, "75%":{ "id":35014.5, "community":16744206.0, "page_rank_norm":0.1264938658, "weight":215.0, "x":1100.2234176144, "y":891.8761373502, "twitter_profile_id":412977526.0 }, "max":{ "id":204406.0, "community":16744206.0, "page_rank_norm":1.0, "weight":770.5, "x":2252.6290667868, "y":2101.5421596499, "twitter_profile_id":1.086037534e+18 } } # Randome sample of 10 rows from the dataframe. df_random_sample = { "count":{ "id":1039.0, "community":1039.0, "page_rank_norm":1039.0, "weight":1039.0, "x":1039.0, "y":1039.0, "twitter_profile_id":1039.0 }, "mean":{ "id":23047.0644850818, "community":11681769.4696823861, "page_rank_norm":0.0884803326, "weight":147.2675649663, "x":540.3537380859, "y":394.8444226516, "twitter_profile_id":2.008029257e+16 }, "std":{ "id":39075.4047414455, "community":6854727.7264998332, "page_rank_norm":0.1000416103, "weight":118.9822209357, "x":714.4689670341, "y":690.4519130739, "twitter_profile_id":1.345815525e+17 }, "min":{ "id":101.0, "community":2062260.0, "page_rank_norm":0.0, "weight":1.0, "x":-1367.0425072672, "y":-1543.3173448435, "twitter_profile_id":633.0 }, "25%":{ "id":467.5, "community":2062260.0, "page_rank_norm":0.0161780641, "weight":54.0, "x":8.4145058529, "y":-37.4390967754, "twitter_profile_id":17274921.5 }, "50%":{ "id":7209.0, "community":16744206.0, "page_rank_norm":0.0557416047, "weight":120.5, "x":607.9121194347, "y":394.4469887335, "twitter_profile_id":82890309.0 }, "75%":{ "id":35014.5, "community":16744206.0, "page_rank_norm":0.1264938658, "weight":215.0, "x":1100.2234176144, "y":891.8761373502, "twitter_profile_id":412977526.0 }, "max":{ "id":204406.0, "community":16744206.0, "page_rank_norm":1.0, "weight":770.5, "x":2252.6290667868, "y":2101.5421596499, "twitter_profile_id":1.086037534e+18 } } ''' The question categories are: - boolean: Valid answers include True/False, Y/N, Yes/No (all case insensitive). - category: A value from a cell (or a substring of a cell) in the dataset. - number: A numerical value from a cell in the dataset, which may represent a computed statistic (e.g., average, maximum, minimum). - list[category]: A list containing a fixed number of categories. The expected format is: "['cat', 'dog']". Pay attention to the wording of the question to determine if uniqueness is required or if repeated values are allowed. - list[number]: Similar to list[category], but with numbers as its elements. ''' # TODO: complete the following function in one line, by completing the return statement. It should give the answer to: How many rows are there in this dataframe? def example(df: pd.DataFrame): df.columns=["A"] # Expected output type: is number, this will be checked. return df.shape[0] # It should give the answer to: What are the bottom 4 entity IDs in terms of page rank norm? # The answer should only contain python code, you are not allowed leave any TODO undone. def answer(df: pd.DataFrame): # Use df to answer: What are the bottom 4 entity IDs in terms of page rank norm? df.columns = ['id', 'name', 'pic', 'is_organization', 'community', 'page_rank_norm', 'weight', 'x', 'y', 'twitter_profile_id', 'gx_link_target', 'gx_link_weight', 'gx_link_reciprocal', 'gx_link_should'] # Expected output type: is list[number], this will be checked. return
20250129013725
278
What are the top 6 page rank norms of the entities?
063_Influencers
dev
list[number]
['page_rank_norm']
dev
# Instructions: Generate ONLY python code. Do not include explanations. # you can use pandas and numpy. Use the meta data information from df_schema, df_descprtion. import pandas as pd import numpy as np # Description of dataframe schema. df_schema = { "columns": [ { "name": "id", "type": "uint32" }, { "name": "name", "type": "category" }, { "name": "pic", "type": "category" }, { "name": "is_organization", "type": "bool" }, { "name": "community", "type": "uint32" }, { "name": "page_rank_norm", "type": "float64" }, { "name": "weight", "type": "float64" }, { "name": "x", "type": "float64" }, { "name": "y", "type": "float64" }, { "name": "twitter_profile_id", "type": "int64" }, { "name": "gx_link_target", "type": "object" }, { "name": "gx_link_weight", "type": "object" }, { "name": "gx_link_reciprocal", "type": "object" }, { "name": "gx_link_should", "type": "object" } ] } # Description of dataframe columns. df_descrption = { "count":{ "id":1039.0, "community":1039.0, "page_rank_norm":1039.0, "weight":1039.0, "x":1039.0, "y":1039.0, "twitter_profile_id":1039.0 }, "mean":{ "id":23047.0644850818, "community":11681769.4696823861, "page_rank_norm":0.0884803326, "weight":147.2675649663, "x":540.3537380859, "y":394.8444226516, "twitter_profile_id":2.008029257e+16 }, "std":{ "id":39075.4047414455, "community":6854727.7264998332, "page_rank_norm":0.1000416103, "weight":118.9822209357, "x":714.4689670341, "y":690.4519130739, "twitter_profile_id":1.345815525e+17 }, "min":{ "id":101.0, "community":2062260.0, "page_rank_norm":0.0, "weight":1.0, "x":-1367.0425072672, "y":-1543.3173448435, "twitter_profile_id":633.0 }, "25%":{ "id":467.5, "community":2062260.0, "page_rank_norm":0.0161780641, "weight":54.0, "x":8.4145058529, "y":-37.4390967754, "twitter_profile_id":17274921.5 }, "50%":{ "id":7209.0, "community":16744206.0, "page_rank_norm":0.0557416047, "weight":120.5, "x":607.9121194347, "y":394.4469887335, "twitter_profile_id":82890309.0 }, "75%":{ "id":35014.5, "community":16744206.0, "page_rank_norm":0.1264938658, "weight":215.0, "x":1100.2234176144, "y":891.8761373502, "twitter_profile_id":412977526.0 }, "max":{ "id":204406.0, "community":16744206.0, "page_rank_norm":1.0, "weight":770.5, "x":2252.6290667868, "y":2101.5421596499, "twitter_profile_id":1.086037534e+18 } } # Randome sample of 10 rows from the dataframe. df_random_sample = { "count":{ "id":1039.0, "community":1039.0, "page_rank_norm":1039.0, "weight":1039.0, "x":1039.0, "y":1039.0, "twitter_profile_id":1039.0 }, "mean":{ "id":23047.0644850818, "community":11681769.4696823861, "page_rank_norm":0.0884803326, "weight":147.2675649663, "x":540.3537380859, "y":394.8444226516, "twitter_profile_id":2.008029257e+16 }, "std":{ "id":39075.4047414455, "community":6854727.7264998332, "page_rank_norm":0.1000416103, "weight":118.9822209357, "x":714.4689670341, "y":690.4519130739, "twitter_profile_id":1.345815525e+17 }, "min":{ "id":101.0, "community":2062260.0, "page_rank_norm":0.0, "weight":1.0, "x":-1367.0425072672, "y":-1543.3173448435, "twitter_profile_id":633.0 }, "25%":{ "id":467.5, "community":2062260.0, "page_rank_norm":0.0161780641, "weight":54.0, "x":8.4145058529, "y":-37.4390967754, "twitter_profile_id":17274921.5 }, "50%":{ "id":7209.0, "community":16744206.0, "page_rank_norm":0.0557416047, "weight":120.5, "x":607.9121194347, "y":394.4469887335, "twitter_profile_id":82890309.0 }, "75%":{ "id":35014.5, "community":16744206.0, "page_rank_norm":0.1264938658, "weight":215.0, "x":1100.2234176144, "y":891.8761373502, "twitter_profile_id":412977526.0 }, "max":{ "id":204406.0, "community":16744206.0, "page_rank_norm":1.0, "weight":770.5, "x":2252.6290667868, "y":2101.5421596499, "twitter_profile_id":1.086037534e+18 } } ''' The question categories are: - boolean: Valid answers include True/False, Y/N, Yes/No (all case insensitive). - category: A value from a cell (or a substring of a cell) in the dataset. - number: A numerical value from a cell in the dataset, which may represent a computed statistic (e.g., average, maximum, minimum). - list[category]: A list containing a fixed number of categories. The expected format is: "['cat', 'dog']". Pay attention to the wording of the question to determine if uniqueness is required or if repeated values are allowed. - list[number]: Similar to list[category], but with numbers as its elements. ''' # TODO: complete the following function in one line, by completing the return statement. It should give the answer to: How many rows are there in this dataframe? def example(df: pd.DataFrame): df.columns=["A"] # Expected output type: is number, this will be checked. return df.shape[0] # It should give the answer to: What are the top 6 page rank norms of the entities? # The answer should only contain python code, you are not allowed leave any TODO undone. def answer(df: pd.DataFrame): # Use df to answer: What are the top 6 page rank norms of the entities? df.columns = ['id', 'name', 'pic', 'is_organization', 'community', 'page_rank_norm', 'weight', 'x', 'y', 'twitter_profile_id', 'gx_link_target', 'gx_link_weight', 'gx_link_reciprocal', 'gx_link_should'] # Expected output type: is list[number], this will be checked. return
20250129013725
279
What are the bottom 3 weights of the entities?
063_Influencers
dev
list[number]
['weight']
dev
# Instructions: Generate ONLY python code. Do not include explanations. # you can use pandas and numpy. Use the meta data information from df_schema, df_descprtion. import pandas as pd import numpy as np # Description of dataframe schema. df_schema = { "columns": [ { "name": "id", "type": "uint32" }, { "name": "name", "type": "category" }, { "name": "pic", "type": "category" }, { "name": "is_organization", "type": "bool" }, { "name": "community", "type": "uint32" }, { "name": "page_rank_norm", "type": "float64" }, { "name": "weight", "type": "float64" }, { "name": "x", "type": "float64" }, { "name": "y", "type": "float64" }, { "name": "twitter_profile_id", "type": "int64" }, { "name": "gx_link_target", "type": "object" }, { "name": "gx_link_weight", "type": "object" }, { "name": "gx_link_reciprocal", "type": "object" }, { "name": "gx_link_should", "type": "object" } ] } # Description of dataframe columns. df_descrption = { "count":{ "id":1039.0, "community":1039.0, "page_rank_norm":1039.0, "weight":1039.0, "x":1039.0, "y":1039.0, "twitter_profile_id":1039.0 }, "mean":{ "id":23047.0644850818, "community":11681769.4696823861, "page_rank_norm":0.0884803326, "weight":147.2675649663, "x":540.3537380859, "y":394.8444226516, "twitter_profile_id":2.008029257e+16 }, "std":{ "id":39075.4047414455, "community":6854727.7264998332, "page_rank_norm":0.1000416103, "weight":118.9822209357, "x":714.4689670341, "y":690.4519130739, "twitter_profile_id":1.345815525e+17 }, "min":{ "id":101.0, "community":2062260.0, "page_rank_norm":0.0, "weight":1.0, "x":-1367.0425072672, "y":-1543.3173448435, "twitter_profile_id":633.0 }, "25%":{ "id":467.5, "community":2062260.0, "page_rank_norm":0.0161780641, "weight":54.0, "x":8.4145058529, "y":-37.4390967754, "twitter_profile_id":17274921.5 }, "50%":{ "id":7209.0, "community":16744206.0, "page_rank_norm":0.0557416047, "weight":120.5, "x":607.9121194347, "y":394.4469887335, "twitter_profile_id":82890309.0 }, "75%":{ "id":35014.5, "community":16744206.0, "page_rank_norm":0.1264938658, "weight":215.0, "x":1100.2234176144, "y":891.8761373502, "twitter_profile_id":412977526.0 }, "max":{ "id":204406.0, "community":16744206.0, "page_rank_norm":1.0, "weight":770.5, "x":2252.6290667868, "y":2101.5421596499, "twitter_profile_id":1.086037534e+18 } } # Randome sample of 10 rows from the dataframe. df_random_sample = { "count":{ "id":1039.0, "community":1039.0, "page_rank_norm":1039.0, "weight":1039.0, "x":1039.0, "y":1039.0, "twitter_profile_id":1039.0 }, "mean":{ "id":23047.0644850818, "community":11681769.4696823861, "page_rank_norm":0.0884803326, "weight":147.2675649663, "x":540.3537380859, "y":394.8444226516, "twitter_profile_id":2.008029257e+16 }, "std":{ "id":39075.4047414455, "community":6854727.7264998332, "page_rank_norm":0.1000416103, "weight":118.9822209357, "x":714.4689670341, "y":690.4519130739, "twitter_profile_id":1.345815525e+17 }, "min":{ "id":101.0, "community":2062260.0, "page_rank_norm":0.0, "weight":1.0, "x":-1367.0425072672, "y":-1543.3173448435, "twitter_profile_id":633.0 }, "25%":{ "id":467.5, "community":2062260.0, "page_rank_norm":0.0161780641, "weight":54.0, "x":8.4145058529, "y":-37.4390967754, "twitter_profile_id":17274921.5 }, "50%":{ "id":7209.0, "community":16744206.0, "page_rank_norm":0.0557416047, "weight":120.5, "x":607.9121194347, "y":394.4469887335, "twitter_profile_id":82890309.0 }, "75%":{ "id":35014.5, "community":16744206.0, "page_rank_norm":0.1264938658, "weight":215.0, "x":1100.2234176144, "y":891.8761373502, "twitter_profile_id":412977526.0 }, "max":{ "id":204406.0, "community":16744206.0, "page_rank_norm":1.0, "weight":770.5, "x":2252.6290667868, "y":2101.5421596499, "twitter_profile_id":1.086037534e+18 } } ''' The question categories are: - boolean: Valid answers include True/False, Y/N, Yes/No (all case insensitive). - category: A value from a cell (or a substring of a cell) in the dataset. - number: A numerical value from a cell in the dataset, which may represent a computed statistic (e.g., average, maximum, minimum). - list[category]: A list containing a fixed number of categories. The expected format is: "['cat', 'dog']". Pay attention to the wording of the question to determine if uniqueness is required or if repeated values are allowed. - list[number]: Similar to list[category], but with numbers as its elements. ''' # TODO: complete the following function in one line, by completing the return statement. It should give the answer to: How many rows are there in this dataframe? def example(df: pd.DataFrame): df.columns=["A"] # Expected output type: is number, this will be checked. return df.shape[0] # It should give the answer to: What are the bottom 3 weights of the entities? # The answer should only contain python code, you are not allowed leave any TODO undone. def answer(df: pd.DataFrame): # Use df to answer: What are the bottom 3 weights of the entities? df.columns = ['id', 'name', 'pic', 'is_organization', 'community', 'page_rank_norm', 'weight', 'x', 'y', 'twitter_profile_id', 'gx_link_target', 'gx_link_weight', 'gx_link_reciprocal', 'gx_link_should'] # Expected output type: is list[number], this will be checked. return
20250129013725
280
Are there any animals with feathers in the dataset?
064_Clustering
dev
boolean
['feathers']
dev
# Instructions: Generate ONLY python code. Do not include explanations. # you can use pandas and numpy. Use the meta data information from df_schema, df_descprtion. import pandas as pd import numpy as np # Description of dataframe schema. df_schema = { "columns": [ { "name": "animal_name", "type": "category" }, { "name": "hair", "type": "uint8" }, { "name": "feathers", "type": "uint8" }, { "name": "eggs", "type": "uint8" }, { "name": "milk", "type": "uint8" }, { "name": "airborne", "type": "uint8" }, { "name": "aquatic", "type": "uint8" }, { "name": "predator", "type": "uint8" }, { "name": "toothed", "type": "uint8" }, { "name": "backbone", "type": "uint8" }, { "name": "breathes", "type": "uint8" }, { "name": "venomous", "type": "uint8" }, { "name": "fins", "type": "uint8" }, { "name": "legs", "type": "uint8" }, { "name": "tail", "type": "uint8" }, { "name": "domestic", "type": "uint8" }, { "name": "catsize", "type": "uint8" }, { "name": "class_type", "type": "uint8" } ] } # Description of dataframe columns. df_descrption = { "count":{ "hair":101.0, "feathers":101.0, "eggs":101.0, "milk":101.0, "airborne":101.0, "aquatic":101.0, "predator":101.0, "toothed":101.0, "backbone":101.0, "breathes":101.0, "venomous":101.0, "fins":101.0, "legs":101.0, "tail":101.0, "domestic":101.0, "catsize":101.0, "class_type":101.0 }, "mean":{ "hair":0.4257425743, "feathers":0.198019802, "eggs":0.5841584158, "milk":0.4059405941, "airborne":0.2376237624, "aquatic":0.3564356436, "predator":0.5544554455, "toothed":0.603960396, "backbone":0.8217821782, "breathes":0.7920792079, "venomous":0.0792079208, "fins":0.1683168317, "legs":2.8415841584, "tail":0.7425742574, "domestic":0.1287128713, "catsize":0.4356435644, "class_type":2.8316831683 }, "std":{ "hair":0.4969212141, "feathers":0.4004947435, "eggs":0.495324676, "milk":0.4935223971, "airborne":0.4277502741, "aquatic":0.4813347778, "predator":0.4995047052, "toothed":0.4915121142, "backbone":0.3846047219, "breathes":0.4078438839, "venomous":0.2714099599, "fins":0.376013482, "legs":2.0333847313, "tail":0.4393965259, "domestic":0.3365521159, "catsize":0.4983139891, "class_type":2.1027092378 }, "min":{ "hair":0.0, "feathers":0.0, "eggs":0.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":0.0, "toothed":0.0, "backbone":0.0, "breathes":0.0, "venomous":0.0, "fins":0.0, "legs":0.0, "tail":0.0, "domestic":0.0, "catsize":0.0, "class_type":1.0 }, "25%":{ "hair":0.0, "feathers":0.0, "eggs":0.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":0.0, "toothed":0.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":2.0, "tail":0.0, "domestic":0.0, "catsize":0.0, "class_type":1.0 }, "50%":{ "hair":0.0, "feathers":0.0, "eggs":1.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":4.0, "tail":1.0, "domestic":0.0, "catsize":0.0, "class_type":2.0 }, "75%":{ "hair":1.0, "feathers":0.0, "eggs":1.0, "milk":1.0, "airborne":0.0, "aquatic":1.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":4.0, "tail":1.0, "domestic":0.0, "catsize":1.0, "class_type":4.0 }, "max":{ "hair":1.0, "feathers":1.0, "eggs":1.0, "milk":1.0, "airborne":1.0, "aquatic":1.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":1.0, "fins":1.0, "legs":8.0, "tail":1.0, "domestic":1.0, "catsize":1.0, "class_type":7.0 } } # Randome sample of 10 rows from the dataframe. df_random_sample = { "count":{ "hair":101.0, "feathers":101.0, "eggs":101.0, "milk":101.0, "airborne":101.0, "aquatic":101.0, "predator":101.0, "toothed":101.0, "backbone":101.0, "breathes":101.0, "venomous":101.0, "fins":101.0, "legs":101.0, "tail":101.0, "domestic":101.0, "catsize":101.0, "class_type":101.0 }, "mean":{ "hair":0.4257425743, "feathers":0.198019802, "eggs":0.5841584158, "milk":0.4059405941, "airborne":0.2376237624, "aquatic":0.3564356436, "predator":0.5544554455, "toothed":0.603960396, "backbone":0.8217821782, "breathes":0.7920792079, "venomous":0.0792079208, "fins":0.1683168317, "legs":2.8415841584, "tail":0.7425742574, "domestic":0.1287128713, "catsize":0.4356435644, "class_type":2.8316831683 }, "std":{ "hair":0.4969212141, "feathers":0.4004947435, "eggs":0.495324676, "milk":0.4935223971, "airborne":0.4277502741, "aquatic":0.4813347778, "predator":0.4995047052, "toothed":0.4915121142, "backbone":0.3846047219, "breathes":0.4078438839, "venomous":0.2714099599, "fins":0.376013482, "legs":2.0333847313, "tail":0.4393965259, "domestic":0.3365521159, "catsize":0.4983139891, "class_type":2.1027092378 }, "min":{ "hair":0.0, "feathers":0.0, "eggs":0.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":0.0, "toothed":0.0, "backbone":0.0, "breathes":0.0, "venomous":0.0, "fins":0.0, "legs":0.0, "tail":0.0, "domestic":0.0, "catsize":0.0, "class_type":1.0 }, "25%":{ "hair":0.0, "feathers":0.0, "eggs":0.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":0.0, "toothed":0.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":2.0, "tail":0.0, "domestic":0.0, "catsize":0.0, "class_type":1.0 }, "50%":{ "hair":0.0, "feathers":0.0, "eggs":1.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":4.0, "tail":1.0, "domestic":0.0, "catsize":0.0, "class_type":2.0 }, "75%":{ "hair":1.0, "feathers":0.0, "eggs":1.0, "milk":1.0, "airborne":0.0, "aquatic":1.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":4.0, "tail":1.0, "domestic":0.0, "catsize":1.0, "class_type":4.0 }, "max":{ "hair":1.0, "feathers":1.0, "eggs":1.0, "milk":1.0, "airborne":1.0, "aquatic":1.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":1.0, "fins":1.0, "legs":8.0, "tail":1.0, "domestic":1.0, "catsize":1.0, "class_type":7.0 } } ''' The question categories are: - boolean: Valid answers include True/False, Y/N, Yes/No (all case insensitive). - category: A value from a cell (or a substring of a cell) in the dataset. - number: A numerical value from a cell in the dataset, which may represent a computed statistic (e.g., average, maximum, minimum). - list[category]: A list containing a fixed number of categories. The expected format is: "['cat', 'dog']". Pay attention to the wording of the question to determine if uniqueness is required or if repeated values are allowed. - list[number]: Similar to list[category], but with numbers as its elements. ''' # TODO: complete the following function in one line, by completing the return statement. It should give the answer to: How many rows are there in this dataframe? def example(df: pd.DataFrame): df.columns=["A"] # Expected output type: is number, this will be checked. return df.shape[0] # It should give the answer to: Are there any animals with feathers in the dataset? # The answer should only contain python code, you are not allowed leave any TODO undone. def answer(df: pd.DataFrame): # Use df to answer: Are there any animals with feathers in the dataset? df.columns = ['animal_name', 'hair', 'feathers', 'eggs', 'milk', 'airborne', 'aquatic', 'predator', 'toothed', 'backbone', 'breathes', 'venomous', 'fins', 'legs', 'tail', 'domestic', 'catsize', 'class_type'] # Expected output type: is boolean, this will be checked. return
20250129013725
281
Are there any venomous animals in the dataset?
064_Clustering
dev
boolean
['venomous']
dev
# Instructions: Generate ONLY python code. Do not include explanations. # you can use pandas and numpy. Use the meta data information from df_schema, df_descprtion. import pandas as pd import numpy as np # Description of dataframe schema. df_schema = { "columns": [ { "name": "animal_name", "type": "category" }, { "name": "hair", "type": "uint8" }, { "name": "feathers", "type": "uint8" }, { "name": "eggs", "type": "uint8" }, { "name": "milk", "type": "uint8" }, { "name": "airborne", "type": "uint8" }, { "name": "aquatic", "type": "uint8" }, { "name": "predator", "type": "uint8" }, { "name": "toothed", "type": "uint8" }, { "name": "backbone", "type": "uint8" }, { "name": "breathes", "type": "uint8" }, { "name": "venomous", "type": "uint8" }, { "name": "fins", "type": "uint8" }, { "name": "legs", "type": "uint8" }, { "name": "tail", "type": "uint8" }, { "name": "domestic", "type": "uint8" }, { "name": "catsize", "type": "uint8" }, { "name": "class_type", "type": "uint8" } ] } # Description of dataframe columns. df_descrption = { "count":{ "hair":101.0, "feathers":101.0, "eggs":101.0, "milk":101.0, "airborne":101.0, "aquatic":101.0, "predator":101.0, "toothed":101.0, "backbone":101.0, "breathes":101.0, "venomous":101.0, "fins":101.0, "legs":101.0, "tail":101.0, "domestic":101.0, "catsize":101.0, "class_type":101.0 }, "mean":{ "hair":0.4257425743, "feathers":0.198019802, "eggs":0.5841584158, "milk":0.4059405941, "airborne":0.2376237624, "aquatic":0.3564356436, "predator":0.5544554455, "toothed":0.603960396, "backbone":0.8217821782, "breathes":0.7920792079, "venomous":0.0792079208, "fins":0.1683168317, "legs":2.8415841584, "tail":0.7425742574, "domestic":0.1287128713, "catsize":0.4356435644, "class_type":2.8316831683 }, "std":{ "hair":0.4969212141, "feathers":0.4004947435, "eggs":0.495324676, "milk":0.4935223971, "airborne":0.4277502741, "aquatic":0.4813347778, "predator":0.4995047052, "toothed":0.4915121142, "backbone":0.3846047219, "breathes":0.4078438839, "venomous":0.2714099599, "fins":0.376013482, "legs":2.0333847313, "tail":0.4393965259, "domestic":0.3365521159, "catsize":0.4983139891, "class_type":2.1027092378 }, "min":{ "hair":0.0, "feathers":0.0, "eggs":0.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":0.0, "toothed":0.0, "backbone":0.0, "breathes":0.0, "venomous":0.0, "fins":0.0, "legs":0.0, "tail":0.0, "domestic":0.0, "catsize":0.0, "class_type":1.0 }, "25%":{ "hair":0.0, "feathers":0.0, "eggs":0.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":0.0, "toothed":0.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":2.0, "tail":0.0, "domestic":0.0, "catsize":0.0, "class_type":1.0 }, "50%":{ "hair":0.0, "feathers":0.0, "eggs":1.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":4.0, "tail":1.0, "domestic":0.0, "catsize":0.0, "class_type":2.0 }, "75%":{ "hair":1.0, "feathers":0.0, "eggs":1.0, "milk":1.0, "airborne":0.0, "aquatic":1.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":4.0, "tail":1.0, "domestic":0.0, "catsize":1.0, "class_type":4.0 }, "max":{ "hair":1.0, "feathers":1.0, "eggs":1.0, "milk":1.0, "airborne":1.0, "aquatic":1.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":1.0, "fins":1.0, "legs":8.0, "tail":1.0, "domestic":1.0, "catsize":1.0, "class_type":7.0 } } # Randome sample of 10 rows from the dataframe. df_random_sample = { "count":{ "hair":101.0, "feathers":101.0, "eggs":101.0, "milk":101.0, "airborne":101.0, "aquatic":101.0, "predator":101.0, "toothed":101.0, "backbone":101.0, "breathes":101.0, "venomous":101.0, "fins":101.0, "legs":101.0, "tail":101.0, "domestic":101.0, "catsize":101.0, "class_type":101.0 }, "mean":{ "hair":0.4257425743, "feathers":0.198019802, "eggs":0.5841584158, "milk":0.4059405941, "airborne":0.2376237624, "aquatic":0.3564356436, "predator":0.5544554455, "toothed":0.603960396, "backbone":0.8217821782, "breathes":0.7920792079, "venomous":0.0792079208, "fins":0.1683168317, "legs":2.8415841584, "tail":0.7425742574, "domestic":0.1287128713, "catsize":0.4356435644, "class_type":2.8316831683 }, "std":{ "hair":0.4969212141, "feathers":0.4004947435, "eggs":0.495324676, "milk":0.4935223971, "airborne":0.4277502741, "aquatic":0.4813347778, "predator":0.4995047052, "toothed":0.4915121142, "backbone":0.3846047219, "breathes":0.4078438839, "venomous":0.2714099599, "fins":0.376013482, "legs":2.0333847313, "tail":0.4393965259, "domestic":0.3365521159, "catsize":0.4983139891, "class_type":2.1027092378 }, "min":{ "hair":0.0, "feathers":0.0, "eggs":0.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":0.0, "toothed":0.0, "backbone":0.0, "breathes":0.0, "venomous":0.0, "fins":0.0, "legs":0.0, "tail":0.0, "domestic":0.0, "catsize":0.0, "class_type":1.0 }, "25%":{ "hair":0.0, "feathers":0.0, "eggs":0.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":0.0, "toothed":0.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":2.0, "tail":0.0, "domestic":0.0, "catsize":0.0, "class_type":1.0 }, "50%":{ "hair":0.0, "feathers":0.0, "eggs":1.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":4.0, "tail":1.0, "domestic":0.0, "catsize":0.0, "class_type":2.0 }, "75%":{ "hair":1.0, "feathers":0.0, "eggs":1.0, "milk":1.0, "airborne":0.0, "aquatic":1.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":4.0, "tail":1.0, "domestic":0.0, "catsize":1.0, "class_type":4.0 }, "max":{ "hair":1.0, "feathers":1.0, "eggs":1.0, "milk":1.0, "airborne":1.0, "aquatic":1.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":1.0, "fins":1.0, "legs":8.0, "tail":1.0, "domestic":1.0, "catsize":1.0, "class_type":7.0 } } ''' The question categories are: - boolean: Valid answers include True/False, Y/N, Yes/No (all case insensitive). - category: A value from a cell (or a substring of a cell) in the dataset. - number: A numerical value from a cell in the dataset, which may represent a computed statistic (e.g., average, maximum, minimum). - list[category]: A list containing a fixed number of categories. The expected format is: "['cat', 'dog']". Pay attention to the wording of the question to determine if uniqueness is required or if repeated values are allowed. - list[number]: Similar to list[category], but with numbers as its elements. ''' # TODO: complete the following function in one line, by completing the return statement. It should give the answer to: How many rows are there in this dataframe? def example(df: pd.DataFrame): df.columns=["A"] # Expected output type: is number, this will be checked. return df.shape[0] # It should give the answer to: Are there any venomous animals in the dataset? # The answer should only contain python code, you are not allowed leave any TODO undone. def answer(df: pd.DataFrame): # Use df to answer: Are there any venomous animals in the dataset? df.columns = ['animal_name', 'hair', 'feathers', 'eggs', 'milk', 'airborne', 'aquatic', 'predator', 'toothed', 'backbone', 'breathes', 'venomous', 'fins', 'legs', 'tail', 'domestic', 'catsize', 'class_type'] # Expected output type: is boolean, this will be checked. return
20250129013725
282
Do all animals breathe?
064_Clustering
dev
boolean
['breathes']
dev
# Instructions: Generate ONLY python code. Do not include explanations. # you can use pandas and numpy. Use the meta data information from df_schema, df_descprtion. import pandas as pd import numpy as np # Description of dataframe schema. df_schema = { "columns": [ { "name": "animal_name", "type": "category" }, { "name": "hair", "type": "uint8" }, { "name": "feathers", "type": "uint8" }, { "name": "eggs", "type": "uint8" }, { "name": "milk", "type": "uint8" }, { "name": "airborne", "type": "uint8" }, { "name": "aquatic", "type": "uint8" }, { "name": "predator", "type": "uint8" }, { "name": "toothed", "type": "uint8" }, { "name": "backbone", "type": "uint8" }, { "name": "breathes", "type": "uint8" }, { "name": "venomous", "type": "uint8" }, { "name": "fins", "type": "uint8" }, { "name": "legs", "type": "uint8" }, { "name": "tail", "type": "uint8" }, { "name": "domestic", "type": "uint8" }, { "name": "catsize", "type": "uint8" }, { "name": "class_type", "type": "uint8" } ] } # Description of dataframe columns. df_descrption = { "count":{ "hair":101.0, "feathers":101.0, "eggs":101.0, "milk":101.0, "airborne":101.0, "aquatic":101.0, "predator":101.0, "toothed":101.0, "backbone":101.0, "breathes":101.0, "venomous":101.0, "fins":101.0, "legs":101.0, "tail":101.0, "domestic":101.0, "catsize":101.0, "class_type":101.0 }, "mean":{ "hair":0.4257425743, "feathers":0.198019802, "eggs":0.5841584158, "milk":0.4059405941, "airborne":0.2376237624, "aquatic":0.3564356436, "predator":0.5544554455, "toothed":0.603960396, "backbone":0.8217821782, "breathes":0.7920792079, "venomous":0.0792079208, "fins":0.1683168317, "legs":2.8415841584, "tail":0.7425742574, "domestic":0.1287128713, "catsize":0.4356435644, "class_type":2.8316831683 }, "std":{ "hair":0.4969212141, "feathers":0.4004947435, "eggs":0.495324676, "milk":0.4935223971, "airborne":0.4277502741, "aquatic":0.4813347778, "predator":0.4995047052, "toothed":0.4915121142, "backbone":0.3846047219, "breathes":0.4078438839, "venomous":0.2714099599, "fins":0.376013482, "legs":2.0333847313, "tail":0.4393965259, "domestic":0.3365521159, "catsize":0.4983139891, "class_type":2.1027092378 }, "min":{ "hair":0.0, "feathers":0.0, "eggs":0.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":0.0, "toothed":0.0, "backbone":0.0, "breathes":0.0, "venomous":0.0, "fins":0.0, "legs":0.0, "tail":0.0, "domestic":0.0, "catsize":0.0, "class_type":1.0 }, "25%":{ "hair":0.0, "feathers":0.0, "eggs":0.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":0.0, "toothed":0.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":2.0, "tail":0.0, "domestic":0.0, "catsize":0.0, "class_type":1.0 }, "50%":{ "hair":0.0, "feathers":0.0, "eggs":1.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":4.0, "tail":1.0, "domestic":0.0, "catsize":0.0, "class_type":2.0 }, "75%":{ "hair":1.0, "feathers":0.0, "eggs":1.0, "milk":1.0, "airborne":0.0, "aquatic":1.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":4.0, "tail":1.0, "domestic":0.0, "catsize":1.0, "class_type":4.0 }, "max":{ "hair":1.0, "feathers":1.0, "eggs":1.0, "milk":1.0, "airborne":1.0, "aquatic":1.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":1.0, "fins":1.0, "legs":8.0, "tail":1.0, "domestic":1.0, "catsize":1.0, "class_type":7.0 } } # Randome sample of 10 rows from the dataframe. df_random_sample = { "count":{ "hair":101.0, "feathers":101.0, "eggs":101.0, "milk":101.0, "airborne":101.0, "aquatic":101.0, "predator":101.0, "toothed":101.0, "backbone":101.0, "breathes":101.0, "venomous":101.0, "fins":101.0, "legs":101.0, "tail":101.0, "domestic":101.0, "catsize":101.0, "class_type":101.0 }, "mean":{ "hair":0.4257425743, "feathers":0.198019802, "eggs":0.5841584158, "milk":0.4059405941, "airborne":0.2376237624, "aquatic":0.3564356436, "predator":0.5544554455, "toothed":0.603960396, "backbone":0.8217821782, "breathes":0.7920792079, "venomous":0.0792079208, "fins":0.1683168317, "legs":2.8415841584, "tail":0.7425742574, "domestic":0.1287128713, "catsize":0.4356435644, "class_type":2.8316831683 }, "std":{ "hair":0.4969212141, "feathers":0.4004947435, "eggs":0.495324676, "milk":0.4935223971, "airborne":0.4277502741, "aquatic":0.4813347778, "predator":0.4995047052, "toothed":0.4915121142, "backbone":0.3846047219, "breathes":0.4078438839, "venomous":0.2714099599, "fins":0.376013482, "legs":2.0333847313, "tail":0.4393965259, "domestic":0.3365521159, "catsize":0.4983139891, "class_type":2.1027092378 }, "min":{ "hair":0.0, "feathers":0.0, "eggs":0.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":0.0, "toothed":0.0, "backbone":0.0, "breathes":0.0, "venomous":0.0, "fins":0.0, "legs":0.0, "tail":0.0, "domestic":0.0, "catsize":0.0, "class_type":1.0 }, "25%":{ "hair":0.0, "feathers":0.0, "eggs":0.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":0.0, "toothed":0.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":2.0, "tail":0.0, "domestic":0.0, "catsize":0.0, "class_type":1.0 }, "50%":{ "hair":0.0, "feathers":0.0, "eggs":1.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":4.0, "tail":1.0, "domestic":0.0, "catsize":0.0, "class_type":2.0 }, "75%":{ "hair":1.0, "feathers":0.0, "eggs":1.0, "milk":1.0, "airborne":0.0, "aquatic":1.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":4.0, "tail":1.0, "domestic":0.0, "catsize":1.0, "class_type":4.0 }, "max":{ "hair":1.0, "feathers":1.0, "eggs":1.0, "milk":1.0, "airborne":1.0, "aquatic":1.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":1.0, "fins":1.0, "legs":8.0, "tail":1.0, "domestic":1.0, "catsize":1.0, "class_type":7.0 } } ''' The question categories are: - boolean: Valid answers include True/False, Y/N, Yes/No (all case insensitive). - category: A value from a cell (or a substring of a cell) in the dataset. - number: A numerical value from a cell in the dataset, which may represent a computed statistic (e.g., average, maximum, minimum). - list[category]: A list containing a fixed number of categories. The expected format is: "['cat', 'dog']". Pay attention to the wording of the question to determine if uniqueness is required or if repeated values are allowed. - list[number]: Similar to list[category], but with numbers as its elements. ''' # TODO: complete the following function in one line, by completing the return statement. It should give the answer to: How many rows are there in this dataframe? def example(df: pd.DataFrame): df.columns=["A"] # Expected output type: is number, this will be checked. return df.shape[0] # It should give the answer to: Do all animals breathe? # The answer should only contain python code, you are not allowed leave any TODO undone. def answer(df: pd.DataFrame): # Use df to answer: Do all animals breathe? df.columns = ['animal_name', 'hair', 'feathers', 'eggs', 'milk', 'airborne', 'aquatic', 'predator', 'toothed', 'backbone', 'breathes', 'venomous', 'fins', 'legs', 'tail', 'domestic', 'catsize', 'class_type'] # Expected output type: is boolean, this will be checked. return
20250129013725
283
Are there any domesticated animals in the dataset?
064_Clustering
dev
boolean
['domestic']
dev
# Instructions: Generate ONLY python code. Do not include explanations. # you can use pandas and numpy. Use the meta data information from df_schema, df_descprtion. import pandas as pd import numpy as np # Description of dataframe schema. df_schema = { "columns": [ { "name": "animal_name", "type": "category" }, { "name": "hair", "type": "uint8" }, { "name": "feathers", "type": "uint8" }, { "name": "eggs", "type": "uint8" }, { "name": "milk", "type": "uint8" }, { "name": "airborne", "type": "uint8" }, { "name": "aquatic", "type": "uint8" }, { "name": "predator", "type": "uint8" }, { "name": "toothed", "type": "uint8" }, { "name": "backbone", "type": "uint8" }, { "name": "breathes", "type": "uint8" }, { "name": "venomous", "type": "uint8" }, { "name": "fins", "type": "uint8" }, { "name": "legs", "type": "uint8" }, { "name": "tail", "type": "uint8" }, { "name": "domestic", "type": "uint8" }, { "name": "catsize", "type": "uint8" }, { "name": "class_type", "type": "uint8" } ] } # Description of dataframe columns. df_descrption = { "count":{ "hair":101.0, "feathers":101.0, "eggs":101.0, "milk":101.0, "airborne":101.0, "aquatic":101.0, "predator":101.0, "toothed":101.0, "backbone":101.0, "breathes":101.0, "venomous":101.0, "fins":101.0, "legs":101.0, "tail":101.0, "domestic":101.0, "catsize":101.0, "class_type":101.0 }, "mean":{ "hair":0.4257425743, "feathers":0.198019802, "eggs":0.5841584158, "milk":0.4059405941, "airborne":0.2376237624, "aquatic":0.3564356436, "predator":0.5544554455, "toothed":0.603960396, "backbone":0.8217821782, "breathes":0.7920792079, "venomous":0.0792079208, "fins":0.1683168317, "legs":2.8415841584, "tail":0.7425742574, "domestic":0.1287128713, "catsize":0.4356435644, "class_type":2.8316831683 }, "std":{ "hair":0.4969212141, "feathers":0.4004947435, "eggs":0.495324676, "milk":0.4935223971, "airborne":0.4277502741, "aquatic":0.4813347778, "predator":0.4995047052, "toothed":0.4915121142, "backbone":0.3846047219, "breathes":0.4078438839, "venomous":0.2714099599, "fins":0.376013482, "legs":2.0333847313, "tail":0.4393965259, "domestic":0.3365521159, "catsize":0.4983139891, "class_type":2.1027092378 }, "min":{ "hair":0.0, "feathers":0.0, "eggs":0.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":0.0, "toothed":0.0, "backbone":0.0, "breathes":0.0, "venomous":0.0, "fins":0.0, "legs":0.0, "tail":0.0, "domestic":0.0, "catsize":0.0, "class_type":1.0 }, "25%":{ "hair":0.0, "feathers":0.0, "eggs":0.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":0.0, "toothed":0.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":2.0, "tail":0.0, "domestic":0.0, "catsize":0.0, "class_type":1.0 }, "50%":{ "hair":0.0, "feathers":0.0, "eggs":1.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":4.0, "tail":1.0, "domestic":0.0, "catsize":0.0, "class_type":2.0 }, "75%":{ "hair":1.0, "feathers":0.0, "eggs":1.0, "milk":1.0, "airborne":0.0, "aquatic":1.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":4.0, "tail":1.0, "domestic":0.0, "catsize":1.0, "class_type":4.0 }, "max":{ "hair":1.0, "feathers":1.0, "eggs":1.0, "milk":1.0, "airborne":1.0, "aquatic":1.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":1.0, "fins":1.0, "legs":8.0, "tail":1.0, "domestic":1.0, "catsize":1.0, "class_type":7.0 } } # Randome sample of 10 rows from the dataframe. df_random_sample = { "count":{ "hair":101.0, "feathers":101.0, "eggs":101.0, "milk":101.0, "airborne":101.0, "aquatic":101.0, "predator":101.0, "toothed":101.0, "backbone":101.0, "breathes":101.0, "venomous":101.0, "fins":101.0, "legs":101.0, "tail":101.0, "domestic":101.0, "catsize":101.0, "class_type":101.0 }, "mean":{ "hair":0.4257425743, "feathers":0.198019802, "eggs":0.5841584158, "milk":0.4059405941, "airborne":0.2376237624, "aquatic":0.3564356436, "predator":0.5544554455, "toothed":0.603960396, "backbone":0.8217821782, "breathes":0.7920792079, "venomous":0.0792079208, "fins":0.1683168317, "legs":2.8415841584, "tail":0.7425742574, "domestic":0.1287128713, "catsize":0.4356435644, "class_type":2.8316831683 }, "std":{ "hair":0.4969212141, "feathers":0.4004947435, "eggs":0.495324676, "milk":0.4935223971, "airborne":0.4277502741, "aquatic":0.4813347778, "predator":0.4995047052, "toothed":0.4915121142, "backbone":0.3846047219, "breathes":0.4078438839, "venomous":0.2714099599, "fins":0.376013482, "legs":2.0333847313, "tail":0.4393965259, "domestic":0.3365521159, "catsize":0.4983139891, "class_type":2.1027092378 }, "min":{ "hair":0.0, "feathers":0.0, "eggs":0.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":0.0, "toothed":0.0, "backbone":0.0, "breathes":0.0, "venomous":0.0, "fins":0.0, "legs":0.0, "tail":0.0, "domestic":0.0, "catsize":0.0, "class_type":1.0 }, "25%":{ "hair":0.0, "feathers":0.0, "eggs":0.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":0.0, "toothed":0.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":2.0, "tail":0.0, "domestic":0.0, "catsize":0.0, "class_type":1.0 }, "50%":{ "hair":0.0, "feathers":0.0, "eggs":1.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":4.0, "tail":1.0, "domestic":0.0, "catsize":0.0, "class_type":2.0 }, "75%":{ "hair":1.0, "feathers":0.0, "eggs":1.0, "milk":1.0, "airborne":0.0, "aquatic":1.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":4.0, "tail":1.0, "domestic":0.0, "catsize":1.0, "class_type":4.0 }, "max":{ "hair":1.0, "feathers":1.0, "eggs":1.0, "milk":1.0, "airborne":1.0, "aquatic":1.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":1.0, "fins":1.0, "legs":8.0, "tail":1.0, "domestic":1.0, "catsize":1.0, "class_type":7.0 } } ''' The question categories are: - boolean: Valid answers include True/False, Y/N, Yes/No (all case insensitive). - category: A value from a cell (or a substring of a cell) in the dataset. - number: A numerical value from a cell in the dataset, which may represent a computed statistic (e.g., average, maximum, minimum). - list[category]: A list containing a fixed number of categories. The expected format is: "['cat', 'dog']". Pay attention to the wording of the question to determine if uniqueness is required or if repeated values are allowed. - list[number]: Similar to list[category], but with numbers as its elements. ''' # TODO: complete the following function in one line, by completing the return statement. It should give the answer to: How many rows are there in this dataframe? def example(df: pd.DataFrame): df.columns=["A"] # Expected output type: is number, this will be checked. return df.shape[0] # It should give the answer to: Are there any domesticated animals in the dataset? # The answer should only contain python code, you are not allowed leave any TODO undone. def answer(df: pd.DataFrame): # Use df to answer: Are there any domesticated animals in the dataset? df.columns = ['animal_name', 'hair', 'feathers', 'eggs', 'milk', 'airborne', 'aquatic', 'predator', 'toothed', 'backbone', 'breathes', 'venomous', 'fins', 'legs', 'tail', 'domestic', 'catsize', 'class_type'] # Expected output type: is boolean, this will be checked. return
20250129013725
284
How many unique types of animals are there?
064_Clustering
dev
number
['class_type']
dev
# Instructions: Generate ONLY python code. Do not include explanations. # you can use pandas and numpy. Use the meta data information from df_schema, df_descprtion. import pandas as pd import numpy as np # Description of dataframe schema. df_schema = { "columns": [ { "name": "animal_name", "type": "category" }, { "name": "hair", "type": "uint8" }, { "name": "feathers", "type": "uint8" }, { "name": "eggs", "type": "uint8" }, { "name": "milk", "type": "uint8" }, { "name": "airborne", "type": "uint8" }, { "name": "aquatic", "type": "uint8" }, { "name": "predator", "type": "uint8" }, { "name": "toothed", "type": "uint8" }, { "name": "backbone", "type": "uint8" }, { "name": "breathes", "type": "uint8" }, { "name": "venomous", "type": "uint8" }, { "name": "fins", "type": "uint8" }, { "name": "legs", "type": "uint8" }, { "name": "tail", "type": "uint8" }, { "name": "domestic", "type": "uint8" }, { "name": "catsize", "type": "uint8" }, { "name": "class_type", "type": "uint8" } ] } # Description of dataframe columns. df_descrption = { "count":{ "hair":101.0, "feathers":101.0, "eggs":101.0, "milk":101.0, "airborne":101.0, "aquatic":101.0, "predator":101.0, "toothed":101.0, "backbone":101.0, "breathes":101.0, "venomous":101.0, "fins":101.0, "legs":101.0, "tail":101.0, "domestic":101.0, "catsize":101.0, "class_type":101.0 }, "mean":{ "hair":0.4257425743, "feathers":0.198019802, "eggs":0.5841584158, "milk":0.4059405941, "airborne":0.2376237624, "aquatic":0.3564356436, "predator":0.5544554455, "toothed":0.603960396, "backbone":0.8217821782, "breathes":0.7920792079, "venomous":0.0792079208, "fins":0.1683168317, "legs":2.8415841584, "tail":0.7425742574, "domestic":0.1287128713, "catsize":0.4356435644, "class_type":2.8316831683 }, "std":{ "hair":0.4969212141, "feathers":0.4004947435, "eggs":0.495324676, "milk":0.4935223971, "airborne":0.4277502741, "aquatic":0.4813347778, "predator":0.4995047052, "toothed":0.4915121142, "backbone":0.3846047219, "breathes":0.4078438839, "venomous":0.2714099599, "fins":0.376013482, "legs":2.0333847313, "tail":0.4393965259, "domestic":0.3365521159, "catsize":0.4983139891, "class_type":2.1027092378 }, "min":{ "hair":0.0, "feathers":0.0, "eggs":0.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":0.0, "toothed":0.0, "backbone":0.0, "breathes":0.0, "venomous":0.0, "fins":0.0, "legs":0.0, "tail":0.0, "domestic":0.0, "catsize":0.0, "class_type":1.0 }, "25%":{ "hair":0.0, "feathers":0.0, "eggs":0.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":0.0, "toothed":0.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":2.0, "tail":0.0, "domestic":0.0, "catsize":0.0, "class_type":1.0 }, "50%":{ "hair":0.0, "feathers":0.0, "eggs":1.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":4.0, "tail":1.0, "domestic":0.0, "catsize":0.0, "class_type":2.0 }, "75%":{ "hair":1.0, "feathers":0.0, "eggs":1.0, "milk":1.0, "airborne":0.0, "aquatic":1.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":4.0, "tail":1.0, "domestic":0.0, "catsize":1.0, "class_type":4.0 }, "max":{ "hair":1.0, "feathers":1.0, "eggs":1.0, "milk":1.0, "airborne":1.0, "aquatic":1.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":1.0, "fins":1.0, "legs":8.0, "tail":1.0, "domestic":1.0, "catsize":1.0, "class_type":7.0 } } # Randome sample of 10 rows from the dataframe. df_random_sample = { "count":{ "hair":101.0, "feathers":101.0, "eggs":101.0, "milk":101.0, "airborne":101.0, "aquatic":101.0, "predator":101.0, "toothed":101.0, "backbone":101.0, "breathes":101.0, "venomous":101.0, "fins":101.0, "legs":101.0, "tail":101.0, "domestic":101.0, "catsize":101.0, "class_type":101.0 }, "mean":{ "hair":0.4257425743, "feathers":0.198019802, "eggs":0.5841584158, "milk":0.4059405941, "airborne":0.2376237624, "aquatic":0.3564356436, "predator":0.5544554455, "toothed":0.603960396, "backbone":0.8217821782, "breathes":0.7920792079, "venomous":0.0792079208, "fins":0.1683168317, "legs":2.8415841584, "tail":0.7425742574, "domestic":0.1287128713, "catsize":0.4356435644, "class_type":2.8316831683 }, "std":{ "hair":0.4969212141, "feathers":0.4004947435, "eggs":0.495324676, "milk":0.4935223971, "airborne":0.4277502741, "aquatic":0.4813347778, "predator":0.4995047052, "toothed":0.4915121142, "backbone":0.3846047219, "breathes":0.4078438839, "venomous":0.2714099599, "fins":0.376013482, "legs":2.0333847313, "tail":0.4393965259, "domestic":0.3365521159, "catsize":0.4983139891, "class_type":2.1027092378 }, "min":{ "hair":0.0, "feathers":0.0, "eggs":0.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":0.0, "toothed":0.0, "backbone":0.0, "breathes":0.0, "venomous":0.0, "fins":0.0, "legs":0.0, "tail":0.0, "domestic":0.0, "catsize":0.0, "class_type":1.0 }, "25%":{ "hair":0.0, "feathers":0.0, "eggs":0.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":0.0, "toothed":0.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":2.0, "tail":0.0, "domestic":0.0, "catsize":0.0, "class_type":1.0 }, "50%":{ "hair":0.0, "feathers":0.0, "eggs":1.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":4.0, "tail":1.0, "domestic":0.0, "catsize":0.0, "class_type":2.0 }, "75%":{ "hair":1.0, "feathers":0.0, "eggs":1.0, "milk":1.0, "airborne":0.0, "aquatic":1.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":4.0, "tail":1.0, "domestic":0.0, "catsize":1.0, "class_type":4.0 }, "max":{ "hair":1.0, "feathers":1.0, "eggs":1.0, "milk":1.0, "airborne":1.0, "aquatic":1.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":1.0, "fins":1.0, "legs":8.0, "tail":1.0, "domestic":1.0, "catsize":1.0, "class_type":7.0 } } ''' The question categories are: - boolean: Valid answers include True/False, Y/N, Yes/No (all case insensitive). - category: A value from a cell (or a substring of a cell) in the dataset. - number: A numerical value from a cell in the dataset, which may represent a computed statistic (e.g., average, maximum, minimum). - list[category]: A list containing a fixed number of categories. The expected format is: "['cat', 'dog']". Pay attention to the wording of the question to determine if uniqueness is required or if repeated values are allowed. - list[number]: Similar to list[category], but with numbers as its elements. ''' # TODO: complete the following function in one line, by completing the return statement. It should give the answer to: How many rows are there in this dataframe? def example(df: pd.DataFrame): df.columns=["A"] # Expected output type: is number, this will be checked. return df.shape[0] # It should give the answer to: How many unique types of animals are there? # The answer should only contain python code, you are not allowed leave any TODO undone. def answer(df: pd.DataFrame): # Use df to answer: How many unique types of animals are there? df.columns = ['animal_name', 'hair', 'feathers', 'eggs', 'milk', 'airborne', 'aquatic', 'predator', 'toothed', 'backbone', 'breathes', 'venomous', 'fins', 'legs', 'tail', 'domestic', 'catsize', 'class_type'] # Expected output type: is number, this will be checked. return
20250129013725
285
What is the average number of legs?
064_Clustering
dev
number
['legs']
dev
# Instructions: Generate ONLY python code. Do not include explanations. # you can use pandas and numpy. Use the meta data information from df_schema, df_descprtion. import pandas as pd import numpy as np # Description of dataframe schema. df_schema = { "columns": [ { "name": "animal_name", "type": "category" }, { "name": "hair", "type": "uint8" }, { "name": "feathers", "type": "uint8" }, { "name": "eggs", "type": "uint8" }, { "name": "milk", "type": "uint8" }, { "name": "airborne", "type": "uint8" }, { "name": "aquatic", "type": "uint8" }, { "name": "predator", "type": "uint8" }, { "name": "toothed", "type": "uint8" }, { "name": "backbone", "type": "uint8" }, { "name": "breathes", "type": "uint8" }, { "name": "venomous", "type": "uint8" }, { "name": "fins", "type": "uint8" }, { "name": "legs", "type": "uint8" }, { "name": "tail", "type": "uint8" }, { "name": "domestic", "type": "uint8" }, { "name": "catsize", "type": "uint8" }, { "name": "class_type", "type": "uint8" } ] } # Description of dataframe columns. df_descrption = { "count":{ "hair":101.0, "feathers":101.0, "eggs":101.0, "milk":101.0, "airborne":101.0, "aquatic":101.0, "predator":101.0, "toothed":101.0, "backbone":101.0, "breathes":101.0, "venomous":101.0, "fins":101.0, "legs":101.0, "tail":101.0, "domestic":101.0, "catsize":101.0, "class_type":101.0 }, "mean":{ "hair":0.4257425743, "feathers":0.198019802, "eggs":0.5841584158, "milk":0.4059405941, "airborne":0.2376237624, "aquatic":0.3564356436, "predator":0.5544554455, "toothed":0.603960396, "backbone":0.8217821782, "breathes":0.7920792079, "venomous":0.0792079208, "fins":0.1683168317, "legs":2.8415841584, "tail":0.7425742574, "domestic":0.1287128713, "catsize":0.4356435644, "class_type":2.8316831683 }, "std":{ "hair":0.4969212141, "feathers":0.4004947435, "eggs":0.495324676, "milk":0.4935223971, "airborne":0.4277502741, "aquatic":0.4813347778, "predator":0.4995047052, "toothed":0.4915121142, "backbone":0.3846047219, "breathes":0.4078438839, "venomous":0.2714099599, "fins":0.376013482, "legs":2.0333847313, "tail":0.4393965259, "domestic":0.3365521159, "catsize":0.4983139891, "class_type":2.1027092378 }, "min":{ "hair":0.0, "feathers":0.0, "eggs":0.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":0.0, "toothed":0.0, "backbone":0.0, "breathes":0.0, "venomous":0.0, "fins":0.0, "legs":0.0, "tail":0.0, "domestic":0.0, "catsize":0.0, "class_type":1.0 }, "25%":{ "hair":0.0, "feathers":0.0, "eggs":0.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":0.0, "toothed":0.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":2.0, "tail":0.0, "domestic":0.0, "catsize":0.0, "class_type":1.0 }, "50%":{ "hair":0.0, "feathers":0.0, "eggs":1.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":4.0, "tail":1.0, "domestic":0.0, "catsize":0.0, "class_type":2.0 }, "75%":{ "hair":1.0, "feathers":0.0, "eggs":1.0, "milk":1.0, "airborne":0.0, "aquatic":1.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":4.0, "tail":1.0, "domestic":0.0, "catsize":1.0, "class_type":4.0 }, "max":{ "hair":1.0, "feathers":1.0, "eggs":1.0, "milk":1.0, "airborne":1.0, "aquatic":1.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":1.0, "fins":1.0, "legs":8.0, "tail":1.0, "domestic":1.0, "catsize":1.0, "class_type":7.0 } } # Randome sample of 10 rows from the dataframe. df_random_sample = { "count":{ "hair":101.0, "feathers":101.0, "eggs":101.0, "milk":101.0, "airborne":101.0, "aquatic":101.0, "predator":101.0, "toothed":101.0, "backbone":101.0, "breathes":101.0, "venomous":101.0, "fins":101.0, "legs":101.0, "tail":101.0, "domestic":101.0, "catsize":101.0, "class_type":101.0 }, "mean":{ "hair":0.4257425743, "feathers":0.198019802, "eggs":0.5841584158, "milk":0.4059405941, "airborne":0.2376237624, "aquatic":0.3564356436, "predator":0.5544554455, "toothed":0.603960396, "backbone":0.8217821782, "breathes":0.7920792079, "venomous":0.0792079208, "fins":0.1683168317, "legs":2.8415841584, "tail":0.7425742574, "domestic":0.1287128713, "catsize":0.4356435644, "class_type":2.8316831683 }, "std":{ "hair":0.4969212141, "feathers":0.4004947435, "eggs":0.495324676, "milk":0.4935223971, "airborne":0.4277502741, "aquatic":0.4813347778, "predator":0.4995047052, "toothed":0.4915121142, "backbone":0.3846047219, "breathes":0.4078438839, "venomous":0.2714099599, "fins":0.376013482, "legs":2.0333847313, "tail":0.4393965259, "domestic":0.3365521159, "catsize":0.4983139891, "class_type":2.1027092378 }, "min":{ "hair":0.0, "feathers":0.0, "eggs":0.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":0.0, "toothed":0.0, "backbone":0.0, "breathes":0.0, "venomous":0.0, "fins":0.0, "legs":0.0, "tail":0.0, "domestic":0.0, "catsize":0.0, "class_type":1.0 }, "25%":{ "hair":0.0, "feathers":0.0, "eggs":0.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":0.0, "toothed":0.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":2.0, "tail":0.0, "domestic":0.0, "catsize":0.0, "class_type":1.0 }, "50%":{ "hair":0.0, "feathers":0.0, "eggs":1.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":4.0, "tail":1.0, "domestic":0.0, "catsize":0.0, "class_type":2.0 }, "75%":{ "hair":1.0, "feathers":0.0, "eggs":1.0, "milk":1.0, "airborne":0.0, "aquatic":1.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":4.0, "tail":1.0, "domestic":0.0, "catsize":1.0, "class_type":4.0 }, "max":{ "hair":1.0, "feathers":1.0, "eggs":1.0, "milk":1.0, "airborne":1.0, "aquatic":1.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":1.0, "fins":1.0, "legs":8.0, "tail":1.0, "domestic":1.0, "catsize":1.0, "class_type":7.0 } } ''' The question categories are: - boolean: Valid answers include True/False, Y/N, Yes/No (all case insensitive). - category: A value from a cell (or a substring of a cell) in the dataset. - number: A numerical value from a cell in the dataset, which may represent a computed statistic (e.g., average, maximum, minimum). - list[category]: A list containing a fixed number of categories. The expected format is: "['cat', 'dog']". Pay attention to the wording of the question to determine if uniqueness is required or if repeated values are allowed. - list[number]: Similar to list[category], but with numbers as its elements. ''' # TODO: complete the following function in one line, by completing the return statement. It should give the answer to: How many rows are there in this dataframe? def example(df: pd.DataFrame): df.columns=["A"] # Expected output type: is number, this will be checked. return df.shape[0] # It should give the answer to: What is the average number of legs? # The answer should only contain python code, you are not allowed leave any TODO undone. def answer(df: pd.DataFrame): # Use df to answer: What is the average number of legs? df.columns = ['animal_name', 'hair', 'feathers', 'eggs', 'milk', 'airborne', 'aquatic', 'predator', 'toothed', 'backbone', 'breathes', 'venomous', 'fins', 'legs', 'tail', 'domestic', 'catsize', 'class_type'] # Expected output type: is number, this will be checked. return
20250129013725
286
What is the maximum number of legs an animal has?
064_Clustering
dev
number
['legs']
dev
# Instructions: Generate ONLY python code. Do not include explanations. # you can use pandas and numpy. Use the meta data information from df_schema, df_descprtion. import pandas as pd import numpy as np # Description of dataframe schema. df_schema = { "columns": [ { "name": "animal_name", "type": "category" }, { "name": "hair", "type": "uint8" }, { "name": "feathers", "type": "uint8" }, { "name": "eggs", "type": "uint8" }, { "name": "milk", "type": "uint8" }, { "name": "airborne", "type": "uint8" }, { "name": "aquatic", "type": "uint8" }, { "name": "predator", "type": "uint8" }, { "name": "toothed", "type": "uint8" }, { "name": "backbone", "type": "uint8" }, { "name": "breathes", "type": "uint8" }, { "name": "venomous", "type": "uint8" }, { "name": "fins", "type": "uint8" }, { "name": "legs", "type": "uint8" }, { "name": "tail", "type": "uint8" }, { "name": "domestic", "type": "uint8" }, { "name": "catsize", "type": "uint8" }, { "name": "class_type", "type": "uint8" } ] } # Description of dataframe columns. df_descrption = { "count":{ "hair":101.0, "feathers":101.0, "eggs":101.0, "milk":101.0, "airborne":101.0, "aquatic":101.0, "predator":101.0, "toothed":101.0, "backbone":101.0, "breathes":101.0, "venomous":101.0, "fins":101.0, "legs":101.0, "tail":101.0, "domestic":101.0, "catsize":101.0, "class_type":101.0 }, "mean":{ "hair":0.4257425743, "feathers":0.198019802, "eggs":0.5841584158, "milk":0.4059405941, "airborne":0.2376237624, "aquatic":0.3564356436, "predator":0.5544554455, "toothed":0.603960396, "backbone":0.8217821782, "breathes":0.7920792079, "venomous":0.0792079208, "fins":0.1683168317, "legs":2.8415841584, "tail":0.7425742574, "domestic":0.1287128713, "catsize":0.4356435644, "class_type":2.8316831683 }, "std":{ "hair":0.4969212141, "feathers":0.4004947435, "eggs":0.495324676, "milk":0.4935223971, "airborne":0.4277502741, "aquatic":0.4813347778, "predator":0.4995047052, "toothed":0.4915121142, "backbone":0.3846047219, "breathes":0.4078438839, "venomous":0.2714099599, "fins":0.376013482, "legs":2.0333847313, "tail":0.4393965259, "domestic":0.3365521159, "catsize":0.4983139891, "class_type":2.1027092378 }, "min":{ "hair":0.0, "feathers":0.0, "eggs":0.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":0.0, "toothed":0.0, "backbone":0.0, "breathes":0.0, "venomous":0.0, "fins":0.0, "legs":0.0, "tail":0.0, "domestic":0.0, "catsize":0.0, "class_type":1.0 }, "25%":{ "hair":0.0, "feathers":0.0, "eggs":0.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":0.0, "toothed":0.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":2.0, "tail":0.0, "domestic":0.0, "catsize":0.0, "class_type":1.0 }, "50%":{ "hair":0.0, "feathers":0.0, "eggs":1.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":4.0, "tail":1.0, "domestic":0.0, "catsize":0.0, "class_type":2.0 }, "75%":{ "hair":1.0, "feathers":0.0, "eggs":1.0, "milk":1.0, "airborne":0.0, "aquatic":1.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":4.0, "tail":1.0, "domestic":0.0, "catsize":1.0, "class_type":4.0 }, "max":{ "hair":1.0, "feathers":1.0, "eggs":1.0, "milk":1.0, "airborne":1.0, "aquatic":1.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":1.0, "fins":1.0, "legs":8.0, "tail":1.0, "domestic":1.0, "catsize":1.0, "class_type":7.0 } } # Randome sample of 10 rows from the dataframe. df_random_sample = { "count":{ "hair":101.0, "feathers":101.0, "eggs":101.0, "milk":101.0, "airborne":101.0, "aquatic":101.0, "predator":101.0, "toothed":101.0, "backbone":101.0, "breathes":101.0, "venomous":101.0, "fins":101.0, "legs":101.0, "tail":101.0, "domestic":101.0, "catsize":101.0, "class_type":101.0 }, "mean":{ "hair":0.4257425743, "feathers":0.198019802, "eggs":0.5841584158, "milk":0.4059405941, "airborne":0.2376237624, "aquatic":0.3564356436, "predator":0.5544554455, "toothed":0.603960396, "backbone":0.8217821782, "breathes":0.7920792079, "venomous":0.0792079208, "fins":0.1683168317, "legs":2.8415841584, "tail":0.7425742574, "domestic":0.1287128713, "catsize":0.4356435644, "class_type":2.8316831683 }, "std":{ "hair":0.4969212141, "feathers":0.4004947435, "eggs":0.495324676, "milk":0.4935223971, "airborne":0.4277502741, "aquatic":0.4813347778, "predator":0.4995047052, "toothed":0.4915121142, "backbone":0.3846047219, "breathes":0.4078438839, "venomous":0.2714099599, "fins":0.376013482, "legs":2.0333847313, "tail":0.4393965259, "domestic":0.3365521159, "catsize":0.4983139891, "class_type":2.1027092378 }, "min":{ "hair":0.0, "feathers":0.0, "eggs":0.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":0.0, "toothed":0.0, "backbone":0.0, "breathes":0.0, "venomous":0.0, "fins":0.0, "legs":0.0, "tail":0.0, "domestic":0.0, "catsize":0.0, "class_type":1.0 }, "25%":{ "hair":0.0, "feathers":0.0, "eggs":0.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":0.0, "toothed":0.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":2.0, "tail":0.0, "domestic":0.0, "catsize":0.0, "class_type":1.0 }, "50%":{ "hair":0.0, "feathers":0.0, "eggs":1.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":4.0, "tail":1.0, "domestic":0.0, "catsize":0.0, "class_type":2.0 }, "75%":{ "hair":1.0, "feathers":0.0, "eggs":1.0, "milk":1.0, "airborne":0.0, "aquatic":1.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":4.0, "tail":1.0, "domestic":0.0, "catsize":1.0, "class_type":4.0 }, "max":{ "hair":1.0, "feathers":1.0, "eggs":1.0, "milk":1.0, "airborne":1.0, "aquatic":1.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":1.0, "fins":1.0, "legs":8.0, "tail":1.0, "domestic":1.0, "catsize":1.0, "class_type":7.0 } } ''' The question categories are: - boolean: Valid answers include True/False, Y/N, Yes/No (all case insensitive). - category: A value from a cell (or a substring of a cell) in the dataset. - number: A numerical value from a cell in the dataset, which may represent a computed statistic (e.g., average, maximum, minimum). - list[category]: A list containing a fixed number of categories. The expected format is: "['cat', 'dog']". Pay attention to the wording of the question to determine if uniqueness is required or if repeated values are allowed. - list[number]: Similar to list[category], but with numbers as its elements. ''' # TODO: complete the following function in one line, by completing the return statement. It should give the answer to: How many rows are there in this dataframe? def example(df: pd.DataFrame): df.columns=["A"] # Expected output type: is number, this will be checked. return df.shape[0] # It should give the answer to: What is the maximum number of legs an animal has? # The answer should only contain python code, you are not allowed leave any TODO undone. def answer(df: pd.DataFrame): # Use df to answer: What is the maximum number of legs an animal has? df.columns = ['animal_name', 'hair', 'feathers', 'eggs', 'milk', 'airborne', 'aquatic', 'predator', 'toothed', 'backbone', 'breathes', 'venomous', 'fins', 'legs', 'tail', 'domestic', 'catsize', 'class_type'] # Expected output type: is number, this will be checked. return
20250129013725
287
How many animals are there with 2 legs?
064_Clustering
dev
number
['legs']
dev
# Instructions: Generate ONLY python code. Do not include explanations. # you can use pandas and numpy. Use the meta data information from df_schema, df_descprtion. import pandas as pd import numpy as np # Description of dataframe schema. df_schema = { "columns": [ { "name": "animal_name", "type": "category" }, { "name": "hair", "type": "uint8" }, { "name": "feathers", "type": "uint8" }, { "name": "eggs", "type": "uint8" }, { "name": "milk", "type": "uint8" }, { "name": "airborne", "type": "uint8" }, { "name": "aquatic", "type": "uint8" }, { "name": "predator", "type": "uint8" }, { "name": "toothed", "type": "uint8" }, { "name": "backbone", "type": "uint8" }, { "name": "breathes", "type": "uint8" }, { "name": "venomous", "type": "uint8" }, { "name": "fins", "type": "uint8" }, { "name": "legs", "type": "uint8" }, { "name": "tail", "type": "uint8" }, { "name": "domestic", "type": "uint8" }, { "name": "catsize", "type": "uint8" }, { "name": "class_type", "type": "uint8" } ] } # Description of dataframe columns. df_descrption = { "count":{ "hair":101.0, "feathers":101.0, "eggs":101.0, "milk":101.0, "airborne":101.0, "aquatic":101.0, "predator":101.0, "toothed":101.0, "backbone":101.0, "breathes":101.0, "venomous":101.0, "fins":101.0, "legs":101.0, "tail":101.0, "domestic":101.0, "catsize":101.0, "class_type":101.0 }, "mean":{ "hair":0.4257425743, "feathers":0.198019802, "eggs":0.5841584158, "milk":0.4059405941, "airborne":0.2376237624, "aquatic":0.3564356436, "predator":0.5544554455, "toothed":0.603960396, "backbone":0.8217821782, "breathes":0.7920792079, "venomous":0.0792079208, "fins":0.1683168317, "legs":2.8415841584, "tail":0.7425742574, "domestic":0.1287128713, "catsize":0.4356435644, "class_type":2.8316831683 }, "std":{ "hair":0.4969212141, "feathers":0.4004947435, "eggs":0.495324676, "milk":0.4935223971, "airborne":0.4277502741, "aquatic":0.4813347778, "predator":0.4995047052, "toothed":0.4915121142, "backbone":0.3846047219, "breathes":0.4078438839, "venomous":0.2714099599, "fins":0.376013482, "legs":2.0333847313, "tail":0.4393965259, "domestic":0.3365521159, "catsize":0.4983139891, "class_type":2.1027092378 }, "min":{ "hair":0.0, "feathers":0.0, "eggs":0.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":0.0, "toothed":0.0, "backbone":0.0, "breathes":0.0, "venomous":0.0, "fins":0.0, "legs":0.0, "tail":0.0, "domestic":0.0, "catsize":0.0, "class_type":1.0 }, "25%":{ "hair":0.0, "feathers":0.0, "eggs":0.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":0.0, "toothed":0.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":2.0, "tail":0.0, "domestic":0.0, "catsize":0.0, "class_type":1.0 }, "50%":{ "hair":0.0, "feathers":0.0, "eggs":1.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":4.0, "tail":1.0, "domestic":0.0, "catsize":0.0, "class_type":2.0 }, "75%":{ "hair":1.0, "feathers":0.0, "eggs":1.0, "milk":1.0, "airborne":0.0, "aquatic":1.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":4.0, "tail":1.0, "domestic":0.0, "catsize":1.0, "class_type":4.0 }, "max":{ "hair":1.0, "feathers":1.0, "eggs":1.0, "milk":1.0, "airborne":1.0, "aquatic":1.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":1.0, "fins":1.0, "legs":8.0, "tail":1.0, "domestic":1.0, "catsize":1.0, "class_type":7.0 } } # Randome sample of 10 rows from the dataframe. df_random_sample = { "count":{ "hair":101.0, "feathers":101.0, "eggs":101.0, "milk":101.0, "airborne":101.0, "aquatic":101.0, "predator":101.0, "toothed":101.0, "backbone":101.0, "breathes":101.0, "venomous":101.0, "fins":101.0, "legs":101.0, "tail":101.0, "domestic":101.0, "catsize":101.0, "class_type":101.0 }, "mean":{ "hair":0.4257425743, "feathers":0.198019802, "eggs":0.5841584158, "milk":0.4059405941, "airborne":0.2376237624, "aquatic":0.3564356436, "predator":0.5544554455, "toothed":0.603960396, "backbone":0.8217821782, "breathes":0.7920792079, "venomous":0.0792079208, "fins":0.1683168317, "legs":2.8415841584, "tail":0.7425742574, "domestic":0.1287128713, "catsize":0.4356435644, "class_type":2.8316831683 }, "std":{ "hair":0.4969212141, "feathers":0.4004947435, "eggs":0.495324676, "milk":0.4935223971, "airborne":0.4277502741, "aquatic":0.4813347778, "predator":0.4995047052, "toothed":0.4915121142, "backbone":0.3846047219, "breathes":0.4078438839, "venomous":0.2714099599, "fins":0.376013482, "legs":2.0333847313, "tail":0.4393965259, "domestic":0.3365521159, "catsize":0.4983139891, "class_type":2.1027092378 }, "min":{ "hair":0.0, "feathers":0.0, "eggs":0.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":0.0, "toothed":0.0, "backbone":0.0, "breathes":0.0, "venomous":0.0, "fins":0.0, "legs":0.0, "tail":0.0, "domestic":0.0, "catsize":0.0, "class_type":1.0 }, "25%":{ "hair":0.0, "feathers":0.0, "eggs":0.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":0.0, "toothed":0.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":2.0, "tail":0.0, "domestic":0.0, "catsize":0.0, "class_type":1.0 }, "50%":{ "hair":0.0, "feathers":0.0, "eggs":1.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":4.0, "tail":1.0, "domestic":0.0, "catsize":0.0, "class_type":2.0 }, "75%":{ "hair":1.0, "feathers":0.0, "eggs":1.0, "milk":1.0, "airborne":0.0, "aquatic":1.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":4.0, "tail":1.0, "domestic":0.0, "catsize":1.0, "class_type":4.0 }, "max":{ "hair":1.0, "feathers":1.0, "eggs":1.0, "milk":1.0, "airborne":1.0, "aquatic":1.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":1.0, "fins":1.0, "legs":8.0, "tail":1.0, "domestic":1.0, "catsize":1.0, "class_type":7.0 } } ''' The question categories are: - boolean: Valid answers include True/False, Y/N, Yes/No (all case insensitive). - category: A value from a cell (or a substring of a cell) in the dataset. - number: A numerical value from a cell in the dataset, which may represent a computed statistic (e.g., average, maximum, minimum). - list[category]: A list containing a fixed number of categories. The expected format is: "['cat', 'dog']". Pay attention to the wording of the question to determine if uniqueness is required or if repeated values are allowed. - list[number]: Similar to list[category], but with numbers as its elements. ''' # TODO: complete the following function in one line, by completing the return statement. It should give the answer to: How many rows are there in this dataframe? def example(df: pd.DataFrame): df.columns=["A"] # Expected output type: is number, this will be checked. return df.shape[0] # It should give the answer to: How many animals are there with 2 legs? # The answer should only contain python code, you are not allowed leave any TODO undone. def answer(df: pd.DataFrame): # Use df to answer: How many animals are there with 2 legs? df.columns = ['animal_name', 'hair', 'feathers', 'eggs', 'milk', 'airborne', 'aquatic', 'predator', 'toothed', 'backbone', 'breathes', 'venomous', 'fins', 'legs', 'tail', 'domestic', 'catsize', 'class_type'] # Expected output type: is number, this will be checked. return
20250129013725
288
What is the most common class type?
064_Clustering
dev
category
['class_type']
dev
# Instructions: Generate ONLY python code. Do not include explanations. # you can use pandas and numpy. Use the meta data information from df_schema, df_descprtion. import pandas as pd import numpy as np # Description of dataframe schema. df_schema = { "columns": [ { "name": "animal_name", "type": "category" }, { "name": "hair", "type": "uint8" }, { "name": "feathers", "type": "uint8" }, { "name": "eggs", "type": "uint8" }, { "name": "milk", "type": "uint8" }, { "name": "airborne", "type": "uint8" }, { "name": "aquatic", "type": "uint8" }, { "name": "predator", "type": "uint8" }, { "name": "toothed", "type": "uint8" }, { "name": "backbone", "type": "uint8" }, { "name": "breathes", "type": "uint8" }, { "name": "venomous", "type": "uint8" }, { "name": "fins", "type": "uint8" }, { "name": "legs", "type": "uint8" }, { "name": "tail", "type": "uint8" }, { "name": "domestic", "type": "uint8" }, { "name": "catsize", "type": "uint8" }, { "name": "class_type", "type": "uint8" } ] } # Description of dataframe columns. df_descrption = { "count":{ "hair":101.0, "feathers":101.0, "eggs":101.0, "milk":101.0, "airborne":101.0, "aquatic":101.0, "predator":101.0, "toothed":101.0, "backbone":101.0, "breathes":101.0, "venomous":101.0, "fins":101.0, "legs":101.0, "tail":101.0, "domestic":101.0, "catsize":101.0, "class_type":101.0 }, "mean":{ "hair":0.4257425743, "feathers":0.198019802, "eggs":0.5841584158, "milk":0.4059405941, "airborne":0.2376237624, "aquatic":0.3564356436, "predator":0.5544554455, "toothed":0.603960396, "backbone":0.8217821782, "breathes":0.7920792079, "venomous":0.0792079208, "fins":0.1683168317, "legs":2.8415841584, "tail":0.7425742574, "domestic":0.1287128713, "catsize":0.4356435644, "class_type":2.8316831683 }, "std":{ "hair":0.4969212141, "feathers":0.4004947435, "eggs":0.495324676, "milk":0.4935223971, "airborne":0.4277502741, "aquatic":0.4813347778, "predator":0.4995047052, "toothed":0.4915121142, "backbone":0.3846047219, "breathes":0.4078438839, "venomous":0.2714099599, "fins":0.376013482, "legs":2.0333847313, "tail":0.4393965259, "domestic":0.3365521159, "catsize":0.4983139891, "class_type":2.1027092378 }, "min":{ "hair":0.0, "feathers":0.0, "eggs":0.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":0.0, "toothed":0.0, "backbone":0.0, "breathes":0.0, "venomous":0.0, "fins":0.0, "legs":0.0, "tail":0.0, "domestic":0.0, "catsize":0.0, "class_type":1.0 }, "25%":{ "hair":0.0, "feathers":0.0, "eggs":0.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":0.0, "toothed":0.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":2.0, "tail":0.0, "domestic":0.0, "catsize":0.0, "class_type":1.0 }, "50%":{ "hair":0.0, "feathers":0.0, "eggs":1.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":4.0, "tail":1.0, "domestic":0.0, "catsize":0.0, "class_type":2.0 }, "75%":{ "hair":1.0, "feathers":0.0, "eggs":1.0, "milk":1.0, "airborne":0.0, "aquatic":1.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":4.0, "tail":1.0, "domestic":0.0, "catsize":1.0, "class_type":4.0 }, "max":{ "hair":1.0, "feathers":1.0, "eggs":1.0, "milk":1.0, "airborne":1.0, "aquatic":1.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":1.0, "fins":1.0, "legs":8.0, "tail":1.0, "domestic":1.0, "catsize":1.0, "class_type":7.0 } } # Randome sample of 10 rows from the dataframe. df_random_sample = { "count":{ "hair":101.0, "feathers":101.0, "eggs":101.0, "milk":101.0, "airborne":101.0, "aquatic":101.0, "predator":101.0, "toothed":101.0, "backbone":101.0, "breathes":101.0, "venomous":101.0, "fins":101.0, "legs":101.0, "tail":101.0, "domestic":101.0, "catsize":101.0, "class_type":101.0 }, "mean":{ "hair":0.4257425743, "feathers":0.198019802, "eggs":0.5841584158, "milk":0.4059405941, "airborne":0.2376237624, "aquatic":0.3564356436, "predator":0.5544554455, "toothed":0.603960396, "backbone":0.8217821782, "breathes":0.7920792079, "venomous":0.0792079208, "fins":0.1683168317, "legs":2.8415841584, "tail":0.7425742574, "domestic":0.1287128713, "catsize":0.4356435644, "class_type":2.8316831683 }, "std":{ "hair":0.4969212141, "feathers":0.4004947435, "eggs":0.495324676, "milk":0.4935223971, "airborne":0.4277502741, "aquatic":0.4813347778, "predator":0.4995047052, "toothed":0.4915121142, "backbone":0.3846047219, "breathes":0.4078438839, "venomous":0.2714099599, "fins":0.376013482, "legs":2.0333847313, "tail":0.4393965259, "domestic":0.3365521159, "catsize":0.4983139891, "class_type":2.1027092378 }, "min":{ "hair":0.0, "feathers":0.0, "eggs":0.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":0.0, "toothed":0.0, "backbone":0.0, "breathes":0.0, "venomous":0.0, "fins":0.0, "legs":0.0, "tail":0.0, "domestic":0.0, "catsize":0.0, "class_type":1.0 }, "25%":{ "hair":0.0, "feathers":0.0, "eggs":0.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":0.0, "toothed":0.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":2.0, "tail":0.0, "domestic":0.0, "catsize":0.0, "class_type":1.0 }, "50%":{ "hair":0.0, "feathers":0.0, "eggs":1.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":4.0, "tail":1.0, "domestic":0.0, "catsize":0.0, "class_type":2.0 }, "75%":{ "hair":1.0, "feathers":0.0, "eggs":1.0, "milk":1.0, "airborne":0.0, "aquatic":1.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":4.0, "tail":1.0, "domestic":0.0, "catsize":1.0, "class_type":4.0 }, "max":{ "hair":1.0, "feathers":1.0, "eggs":1.0, "milk":1.0, "airborne":1.0, "aquatic":1.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":1.0, "fins":1.0, "legs":8.0, "tail":1.0, "domestic":1.0, "catsize":1.0, "class_type":7.0 } } ''' The question categories are: - boolean: Valid answers include True/False, Y/N, Yes/No (all case insensitive). - category: A value from a cell (or a substring of a cell) in the dataset. - number: A numerical value from a cell in the dataset, which may represent a computed statistic (e.g., average, maximum, minimum). - list[category]: A list containing a fixed number of categories. The expected format is: "['cat', 'dog']". Pay attention to the wording of the question to determine if uniqueness is required or if repeated values are allowed. - list[number]: Similar to list[category], but with numbers as its elements. ''' # TODO: complete the following function in one line, by completing the return statement. It should give the answer to: How many rows are there in this dataframe? def example(df: pd.DataFrame): df.columns=["A"] # Expected output type: is number, this will be checked. return df.shape[0] # It should give the answer to: What is the most common class type? # The answer should only contain python code, you are not allowed leave any TODO undone. def answer(df: pd.DataFrame): # Use df to answer: What is the most common class type? df.columns = ['animal_name', 'hair', 'feathers', 'eggs', 'milk', 'airborne', 'aquatic', 'predator', 'toothed', 'backbone', 'breathes', 'venomous', 'fins', 'legs', 'tail', 'domestic', 'catsize', 'class_type'] # Expected output type: is category, this will be checked. return
20250129013725
289
What is the name of the first animal with 8 legs?
064_Clustering
dev
category
['animal_name', 'legs']
dev
# Instructions: Generate ONLY python code. Do not include explanations. # you can use pandas and numpy. Use the meta data information from df_schema, df_descprtion. import pandas as pd import numpy as np # Description of dataframe schema. df_schema = { "columns": [ { "name": "animal_name", "type": "category" }, { "name": "hair", "type": "uint8" }, { "name": "feathers", "type": "uint8" }, { "name": "eggs", "type": "uint8" }, { "name": "milk", "type": "uint8" }, { "name": "airborne", "type": "uint8" }, { "name": "aquatic", "type": "uint8" }, { "name": "predator", "type": "uint8" }, { "name": "toothed", "type": "uint8" }, { "name": "backbone", "type": "uint8" }, { "name": "breathes", "type": "uint8" }, { "name": "venomous", "type": "uint8" }, { "name": "fins", "type": "uint8" }, { "name": "legs", "type": "uint8" }, { "name": "tail", "type": "uint8" }, { "name": "domestic", "type": "uint8" }, { "name": "catsize", "type": "uint8" }, { "name": "class_type", "type": "uint8" } ] } # Description of dataframe columns. df_descrption = { "count":{ "hair":101.0, "feathers":101.0, "eggs":101.0, "milk":101.0, "airborne":101.0, "aquatic":101.0, "predator":101.0, "toothed":101.0, "backbone":101.0, "breathes":101.0, "venomous":101.0, "fins":101.0, "legs":101.0, "tail":101.0, "domestic":101.0, "catsize":101.0, "class_type":101.0 }, "mean":{ "hair":0.4257425743, "feathers":0.198019802, "eggs":0.5841584158, "milk":0.4059405941, "airborne":0.2376237624, "aquatic":0.3564356436, "predator":0.5544554455, "toothed":0.603960396, "backbone":0.8217821782, "breathes":0.7920792079, "venomous":0.0792079208, "fins":0.1683168317, "legs":2.8415841584, "tail":0.7425742574, "domestic":0.1287128713, "catsize":0.4356435644, "class_type":2.8316831683 }, "std":{ "hair":0.4969212141, "feathers":0.4004947435, "eggs":0.495324676, "milk":0.4935223971, "airborne":0.4277502741, "aquatic":0.4813347778, "predator":0.4995047052, "toothed":0.4915121142, "backbone":0.3846047219, "breathes":0.4078438839, "venomous":0.2714099599, "fins":0.376013482, "legs":2.0333847313, "tail":0.4393965259, "domestic":0.3365521159, "catsize":0.4983139891, "class_type":2.1027092378 }, "min":{ "hair":0.0, "feathers":0.0, "eggs":0.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":0.0, "toothed":0.0, "backbone":0.0, "breathes":0.0, "venomous":0.0, "fins":0.0, "legs":0.0, "tail":0.0, "domestic":0.0, "catsize":0.0, "class_type":1.0 }, "25%":{ "hair":0.0, "feathers":0.0, "eggs":0.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":0.0, "toothed":0.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":2.0, "tail":0.0, "domestic":0.0, "catsize":0.0, "class_type":1.0 }, "50%":{ "hair":0.0, "feathers":0.0, "eggs":1.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":4.0, "tail":1.0, "domestic":0.0, "catsize":0.0, "class_type":2.0 }, "75%":{ "hair":1.0, "feathers":0.0, "eggs":1.0, "milk":1.0, "airborne":0.0, "aquatic":1.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":4.0, "tail":1.0, "domestic":0.0, "catsize":1.0, "class_type":4.0 }, "max":{ "hair":1.0, "feathers":1.0, "eggs":1.0, "milk":1.0, "airborne":1.0, "aquatic":1.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":1.0, "fins":1.0, "legs":8.0, "tail":1.0, "domestic":1.0, "catsize":1.0, "class_type":7.0 } } # Randome sample of 10 rows from the dataframe. df_random_sample = { "count":{ "hair":101.0, "feathers":101.0, "eggs":101.0, "milk":101.0, "airborne":101.0, "aquatic":101.0, "predator":101.0, "toothed":101.0, "backbone":101.0, "breathes":101.0, "venomous":101.0, "fins":101.0, "legs":101.0, "tail":101.0, "domestic":101.0, "catsize":101.0, "class_type":101.0 }, "mean":{ "hair":0.4257425743, "feathers":0.198019802, "eggs":0.5841584158, "milk":0.4059405941, "airborne":0.2376237624, "aquatic":0.3564356436, "predator":0.5544554455, "toothed":0.603960396, "backbone":0.8217821782, "breathes":0.7920792079, "venomous":0.0792079208, "fins":0.1683168317, "legs":2.8415841584, "tail":0.7425742574, "domestic":0.1287128713, "catsize":0.4356435644, "class_type":2.8316831683 }, "std":{ "hair":0.4969212141, "feathers":0.4004947435, "eggs":0.495324676, "milk":0.4935223971, "airborne":0.4277502741, "aquatic":0.4813347778, "predator":0.4995047052, "toothed":0.4915121142, "backbone":0.3846047219, "breathes":0.4078438839, "venomous":0.2714099599, "fins":0.376013482, "legs":2.0333847313, "tail":0.4393965259, "domestic":0.3365521159, "catsize":0.4983139891, "class_type":2.1027092378 }, "min":{ "hair":0.0, "feathers":0.0, "eggs":0.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":0.0, "toothed":0.0, "backbone":0.0, "breathes":0.0, "venomous":0.0, "fins":0.0, "legs":0.0, "tail":0.0, "domestic":0.0, "catsize":0.0, "class_type":1.0 }, "25%":{ "hair":0.0, "feathers":0.0, "eggs":0.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":0.0, "toothed":0.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":2.0, "tail":0.0, "domestic":0.0, "catsize":0.0, "class_type":1.0 }, "50%":{ "hair":0.0, "feathers":0.0, "eggs":1.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":4.0, "tail":1.0, "domestic":0.0, "catsize":0.0, "class_type":2.0 }, "75%":{ "hair":1.0, "feathers":0.0, "eggs":1.0, "milk":1.0, "airborne":0.0, "aquatic":1.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":4.0, "tail":1.0, "domestic":0.0, "catsize":1.0, "class_type":4.0 }, "max":{ "hair":1.0, "feathers":1.0, "eggs":1.0, "milk":1.0, "airborne":1.0, "aquatic":1.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":1.0, "fins":1.0, "legs":8.0, "tail":1.0, "domestic":1.0, "catsize":1.0, "class_type":7.0 } } ''' The question categories are: - boolean: Valid answers include True/False, Y/N, Yes/No (all case insensitive). - category: A value from a cell (or a substring of a cell) in the dataset. - number: A numerical value from a cell in the dataset, which may represent a computed statistic (e.g., average, maximum, minimum). - list[category]: A list containing a fixed number of categories. The expected format is: "['cat', 'dog']". Pay attention to the wording of the question to determine if uniqueness is required or if repeated values are allowed. - list[number]: Similar to list[category], but with numbers as its elements. ''' # TODO: complete the following function in one line, by completing the return statement. It should give the answer to: How many rows are there in this dataframe? def example(df: pd.DataFrame): df.columns=["A"] # Expected output type: is number, this will be checked. return df.shape[0] # It should give the answer to: What is the name of the first animal with 8 legs? # The answer should only contain python code, you are not allowed leave any TODO undone. def answer(df: pd.DataFrame): # Use df to answer: What is the name of the first animal with 8 legs? df.columns = ['animal_name', 'hair', 'feathers', 'eggs', 'milk', 'airborne', 'aquatic', 'predator', 'toothed', 'backbone', 'breathes', 'venomous', 'fins', 'legs', 'tail', 'domestic', 'catsize', 'class_type'] # Expected output type: is category, this will be checked. return
20250129013725
290
What is the class type of the animals with the most legs?
064_Clustering
dev
category
['class_type', 'legs']
dev
# Instructions: Generate ONLY python code. Do not include explanations. # you can use pandas and numpy. Use the meta data information from df_schema, df_descprtion. import pandas as pd import numpy as np # Description of dataframe schema. df_schema = { "columns": [ { "name": "animal_name", "type": "category" }, { "name": "hair", "type": "uint8" }, { "name": "feathers", "type": "uint8" }, { "name": "eggs", "type": "uint8" }, { "name": "milk", "type": "uint8" }, { "name": "airborne", "type": "uint8" }, { "name": "aquatic", "type": "uint8" }, { "name": "predator", "type": "uint8" }, { "name": "toothed", "type": "uint8" }, { "name": "backbone", "type": "uint8" }, { "name": "breathes", "type": "uint8" }, { "name": "venomous", "type": "uint8" }, { "name": "fins", "type": "uint8" }, { "name": "legs", "type": "uint8" }, { "name": "tail", "type": "uint8" }, { "name": "domestic", "type": "uint8" }, { "name": "catsize", "type": "uint8" }, { "name": "class_type", "type": "uint8" } ] } # Description of dataframe columns. df_descrption = { "count":{ "hair":101.0, "feathers":101.0, "eggs":101.0, "milk":101.0, "airborne":101.0, "aquatic":101.0, "predator":101.0, "toothed":101.0, "backbone":101.0, "breathes":101.0, "venomous":101.0, "fins":101.0, "legs":101.0, "tail":101.0, "domestic":101.0, "catsize":101.0, "class_type":101.0 }, "mean":{ "hair":0.4257425743, "feathers":0.198019802, "eggs":0.5841584158, "milk":0.4059405941, "airborne":0.2376237624, "aquatic":0.3564356436, "predator":0.5544554455, "toothed":0.603960396, "backbone":0.8217821782, "breathes":0.7920792079, "venomous":0.0792079208, "fins":0.1683168317, "legs":2.8415841584, "tail":0.7425742574, "domestic":0.1287128713, "catsize":0.4356435644, "class_type":2.8316831683 }, "std":{ "hair":0.4969212141, "feathers":0.4004947435, "eggs":0.495324676, "milk":0.4935223971, "airborne":0.4277502741, "aquatic":0.4813347778, "predator":0.4995047052, "toothed":0.4915121142, "backbone":0.3846047219, "breathes":0.4078438839, "venomous":0.2714099599, "fins":0.376013482, "legs":2.0333847313, "tail":0.4393965259, "domestic":0.3365521159, "catsize":0.4983139891, "class_type":2.1027092378 }, "min":{ "hair":0.0, "feathers":0.0, "eggs":0.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":0.0, "toothed":0.0, "backbone":0.0, "breathes":0.0, "venomous":0.0, "fins":0.0, "legs":0.0, "tail":0.0, "domestic":0.0, "catsize":0.0, "class_type":1.0 }, "25%":{ "hair":0.0, "feathers":0.0, "eggs":0.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":0.0, "toothed":0.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":2.0, "tail":0.0, "domestic":0.0, "catsize":0.0, "class_type":1.0 }, "50%":{ "hair":0.0, "feathers":0.0, "eggs":1.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":4.0, "tail":1.0, "domestic":0.0, "catsize":0.0, "class_type":2.0 }, "75%":{ "hair":1.0, "feathers":0.0, "eggs":1.0, "milk":1.0, "airborne":0.0, "aquatic":1.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":4.0, "tail":1.0, "domestic":0.0, "catsize":1.0, "class_type":4.0 }, "max":{ "hair":1.0, "feathers":1.0, "eggs":1.0, "milk":1.0, "airborne":1.0, "aquatic":1.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":1.0, "fins":1.0, "legs":8.0, "tail":1.0, "domestic":1.0, "catsize":1.0, "class_type":7.0 } } # Randome sample of 10 rows from the dataframe. df_random_sample = { "count":{ "hair":101.0, "feathers":101.0, "eggs":101.0, "milk":101.0, "airborne":101.0, "aquatic":101.0, "predator":101.0, "toothed":101.0, "backbone":101.0, "breathes":101.0, "venomous":101.0, "fins":101.0, "legs":101.0, "tail":101.0, "domestic":101.0, "catsize":101.0, "class_type":101.0 }, "mean":{ "hair":0.4257425743, "feathers":0.198019802, "eggs":0.5841584158, "milk":0.4059405941, "airborne":0.2376237624, "aquatic":0.3564356436, "predator":0.5544554455, "toothed":0.603960396, "backbone":0.8217821782, "breathes":0.7920792079, "venomous":0.0792079208, "fins":0.1683168317, "legs":2.8415841584, "tail":0.7425742574, "domestic":0.1287128713, "catsize":0.4356435644, "class_type":2.8316831683 }, "std":{ "hair":0.4969212141, "feathers":0.4004947435, "eggs":0.495324676, "milk":0.4935223971, "airborne":0.4277502741, "aquatic":0.4813347778, "predator":0.4995047052, "toothed":0.4915121142, "backbone":0.3846047219, "breathes":0.4078438839, "venomous":0.2714099599, "fins":0.376013482, "legs":2.0333847313, "tail":0.4393965259, "domestic":0.3365521159, "catsize":0.4983139891, "class_type":2.1027092378 }, "min":{ "hair":0.0, "feathers":0.0, "eggs":0.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":0.0, "toothed":0.0, "backbone":0.0, "breathes":0.0, "venomous":0.0, "fins":0.0, "legs":0.0, "tail":0.0, "domestic":0.0, "catsize":0.0, "class_type":1.0 }, "25%":{ "hair":0.0, "feathers":0.0, "eggs":0.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":0.0, "toothed":0.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":2.0, "tail":0.0, "domestic":0.0, "catsize":0.0, "class_type":1.0 }, "50%":{ "hair":0.0, "feathers":0.0, "eggs":1.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":4.0, "tail":1.0, "domestic":0.0, "catsize":0.0, "class_type":2.0 }, "75%":{ "hair":1.0, "feathers":0.0, "eggs":1.0, "milk":1.0, "airborne":0.0, "aquatic":1.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":4.0, "tail":1.0, "domestic":0.0, "catsize":1.0, "class_type":4.0 }, "max":{ "hair":1.0, "feathers":1.0, "eggs":1.0, "milk":1.0, "airborne":1.0, "aquatic":1.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":1.0, "fins":1.0, "legs":8.0, "tail":1.0, "domestic":1.0, "catsize":1.0, "class_type":7.0 } } ''' The question categories are: - boolean: Valid answers include True/False, Y/N, Yes/No (all case insensitive). - category: A value from a cell (or a substring of a cell) in the dataset. - number: A numerical value from a cell in the dataset, which may represent a computed statistic (e.g., average, maximum, minimum). - list[category]: A list containing a fixed number of categories. The expected format is: "['cat', 'dog']". Pay attention to the wording of the question to determine if uniqueness is required or if repeated values are allowed. - list[number]: Similar to list[category], but with numbers as its elements. ''' # TODO: complete the following function in one line, by completing the return statement. It should give the answer to: How many rows are there in this dataframe? def example(df: pd.DataFrame): df.columns=["A"] # Expected output type: is number, this will be checked. return df.shape[0] # It should give the answer to: What is the class type of the animals with the most legs? # The answer should only contain python code, you are not allowed leave any TODO undone. def answer(df: pd.DataFrame): # Use df to answer: What is the class type of the animals with the most legs? df.columns = ['animal_name', 'hair', 'feathers', 'eggs', 'milk', 'airborne', 'aquatic', 'predator', 'toothed', 'backbone', 'breathes', 'venomous', 'fins', 'legs', 'tail', 'domestic', 'catsize', 'class_type'] # Expected output type: is category, this will be checked. return
20250129013725
291
What is the name of the first animal in the dataset that is venomous?
064_Clustering
dev
category
['animal_name', 'venomous']
dev
# Instructions: Generate ONLY python code. Do not include explanations. # you can use pandas and numpy. Use the meta data information from df_schema, df_descprtion. import pandas as pd import numpy as np # Description of dataframe schema. df_schema = { "columns": [ { "name": "animal_name", "type": "category" }, { "name": "hair", "type": "uint8" }, { "name": "feathers", "type": "uint8" }, { "name": "eggs", "type": "uint8" }, { "name": "milk", "type": "uint8" }, { "name": "airborne", "type": "uint8" }, { "name": "aquatic", "type": "uint8" }, { "name": "predator", "type": "uint8" }, { "name": "toothed", "type": "uint8" }, { "name": "backbone", "type": "uint8" }, { "name": "breathes", "type": "uint8" }, { "name": "venomous", "type": "uint8" }, { "name": "fins", "type": "uint8" }, { "name": "legs", "type": "uint8" }, { "name": "tail", "type": "uint8" }, { "name": "domestic", "type": "uint8" }, { "name": "catsize", "type": "uint8" }, { "name": "class_type", "type": "uint8" } ] } # Description of dataframe columns. df_descrption = { "count":{ "hair":101.0, "feathers":101.0, "eggs":101.0, "milk":101.0, "airborne":101.0, "aquatic":101.0, "predator":101.0, "toothed":101.0, "backbone":101.0, "breathes":101.0, "venomous":101.0, "fins":101.0, "legs":101.0, "tail":101.0, "domestic":101.0, "catsize":101.0, "class_type":101.0 }, "mean":{ "hair":0.4257425743, "feathers":0.198019802, "eggs":0.5841584158, "milk":0.4059405941, "airborne":0.2376237624, "aquatic":0.3564356436, "predator":0.5544554455, "toothed":0.603960396, "backbone":0.8217821782, "breathes":0.7920792079, "venomous":0.0792079208, "fins":0.1683168317, "legs":2.8415841584, "tail":0.7425742574, "domestic":0.1287128713, "catsize":0.4356435644, "class_type":2.8316831683 }, "std":{ "hair":0.4969212141, "feathers":0.4004947435, "eggs":0.495324676, "milk":0.4935223971, "airborne":0.4277502741, "aquatic":0.4813347778, "predator":0.4995047052, "toothed":0.4915121142, "backbone":0.3846047219, "breathes":0.4078438839, "venomous":0.2714099599, "fins":0.376013482, "legs":2.0333847313, "tail":0.4393965259, "domestic":0.3365521159, "catsize":0.4983139891, "class_type":2.1027092378 }, "min":{ "hair":0.0, "feathers":0.0, "eggs":0.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":0.0, "toothed":0.0, "backbone":0.0, "breathes":0.0, "venomous":0.0, "fins":0.0, "legs":0.0, "tail":0.0, "domestic":0.0, "catsize":0.0, "class_type":1.0 }, "25%":{ "hair":0.0, "feathers":0.0, "eggs":0.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":0.0, "toothed":0.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":2.0, "tail":0.0, "domestic":0.0, "catsize":0.0, "class_type":1.0 }, "50%":{ "hair":0.0, "feathers":0.0, "eggs":1.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":4.0, "tail":1.0, "domestic":0.0, "catsize":0.0, "class_type":2.0 }, "75%":{ "hair":1.0, "feathers":0.0, "eggs":1.0, "milk":1.0, "airborne":0.0, "aquatic":1.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":4.0, "tail":1.0, "domestic":0.0, "catsize":1.0, "class_type":4.0 }, "max":{ "hair":1.0, "feathers":1.0, "eggs":1.0, "milk":1.0, "airborne":1.0, "aquatic":1.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":1.0, "fins":1.0, "legs":8.0, "tail":1.0, "domestic":1.0, "catsize":1.0, "class_type":7.0 } } # Randome sample of 10 rows from the dataframe. df_random_sample = { "count":{ "hair":101.0, "feathers":101.0, "eggs":101.0, "milk":101.0, "airborne":101.0, "aquatic":101.0, "predator":101.0, "toothed":101.0, "backbone":101.0, "breathes":101.0, "venomous":101.0, "fins":101.0, "legs":101.0, "tail":101.0, "domestic":101.0, "catsize":101.0, "class_type":101.0 }, "mean":{ "hair":0.4257425743, "feathers":0.198019802, "eggs":0.5841584158, "milk":0.4059405941, "airborne":0.2376237624, "aquatic":0.3564356436, "predator":0.5544554455, "toothed":0.603960396, "backbone":0.8217821782, "breathes":0.7920792079, "venomous":0.0792079208, "fins":0.1683168317, "legs":2.8415841584, "tail":0.7425742574, "domestic":0.1287128713, "catsize":0.4356435644, "class_type":2.8316831683 }, "std":{ "hair":0.4969212141, "feathers":0.4004947435, "eggs":0.495324676, "milk":0.4935223971, "airborne":0.4277502741, "aquatic":0.4813347778, "predator":0.4995047052, "toothed":0.4915121142, "backbone":0.3846047219, "breathes":0.4078438839, "venomous":0.2714099599, "fins":0.376013482, "legs":2.0333847313, "tail":0.4393965259, "domestic":0.3365521159, "catsize":0.4983139891, "class_type":2.1027092378 }, "min":{ "hair":0.0, "feathers":0.0, "eggs":0.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":0.0, "toothed":0.0, "backbone":0.0, "breathes":0.0, "venomous":0.0, "fins":0.0, "legs":0.0, "tail":0.0, "domestic":0.0, "catsize":0.0, "class_type":1.0 }, "25%":{ "hair":0.0, "feathers":0.0, "eggs":0.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":0.0, "toothed":0.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":2.0, "tail":0.0, "domestic":0.0, "catsize":0.0, "class_type":1.0 }, "50%":{ "hair":0.0, "feathers":0.0, "eggs":1.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":4.0, "tail":1.0, "domestic":0.0, "catsize":0.0, "class_type":2.0 }, "75%":{ "hair":1.0, "feathers":0.0, "eggs":1.0, "milk":1.0, "airborne":0.0, "aquatic":1.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":4.0, "tail":1.0, "domestic":0.0, "catsize":1.0, "class_type":4.0 }, "max":{ "hair":1.0, "feathers":1.0, "eggs":1.0, "milk":1.0, "airborne":1.0, "aquatic":1.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":1.0, "fins":1.0, "legs":8.0, "tail":1.0, "domestic":1.0, "catsize":1.0, "class_type":7.0 } } ''' The question categories are: - boolean: Valid answers include True/False, Y/N, Yes/No (all case insensitive). - category: A value from a cell (or a substring of a cell) in the dataset. - number: A numerical value from a cell in the dataset, which may represent a computed statistic (e.g., average, maximum, minimum). - list[category]: A list containing a fixed number of categories. The expected format is: "['cat', 'dog']". Pay attention to the wording of the question to determine if uniqueness is required or if repeated values are allowed. - list[number]: Similar to list[category], but with numbers as its elements. ''' # TODO: complete the following function in one line, by completing the return statement. It should give the answer to: How many rows are there in this dataframe? def example(df: pd.DataFrame): df.columns=["A"] # Expected output type: is number, this will be checked. return df.shape[0] # It should give the answer to: What is the name of the first animal in the dataset that is venomous? # The answer should only contain python code, you are not allowed leave any TODO undone. def answer(df: pd.DataFrame): # Use df to answer: What is the name of the first animal in the dataset that is venomous? df.columns = ['animal_name', 'hair', 'feathers', 'eggs', 'milk', 'airborne', 'aquatic', 'predator', 'toothed', 'backbone', 'breathes', 'venomous', 'fins', 'legs', 'tail', 'domestic', 'catsize', 'class_type'] # Expected output type: is category, this will be checked. return
20250129013725
292
What are the top 3 animal names with the most legs? If there are more than two with the lowest number go with alphabetical order
064_Clustering
dev
list[category]
['animal_name', 'legs']
dev
# Instructions: Generate ONLY python code. Do not include explanations. # you can use pandas and numpy. Use the meta data information from df_schema, df_descprtion. import pandas as pd import numpy as np # Description of dataframe schema. df_schema = { "columns": [ { "name": "animal_name", "type": "category" }, { "name": "hair", "type": "uint8" }, { "name": "feathers", "type": "uint8" }, { "name": "eggs", "type": "uint8" }, { "name": "milk", "type": "uint8" }, { "name": "airborne", "type": "uint8" }, { "name": "aquatic", "type": "uint8" }, { "name": "predator", "type": "uint8" }, { "name": "toothed", "type": "uint8" }, { "name": "backbone", "type": "uint8" }, { "name": "breathes", "type": "uint8" }, { "name": "venomous", "type": "uint8" }, { "name": "fins", "type": "uint8" }, { "name": "legs", "type": "uint8" }, { "name": "tail", "type": "uint8" }, { "name": "domestic", "type": "uint8" }, { "name": "catsize", "type": "uint8" }, { "name": "class_type", "type": "uint8" } ] } # Description of dataframe columns. df_descrption = { "count":{ "hair":101.0, "feathers":101.0, "eggs":101.0, "milk":101.0, "airborne":101.0, "aquatic":101.0, "predator":101.0, "toothed":101.0, "backbone":101.0, "breathes":101.0, "venomous":101.0, "fins":101.0, "legs":101.0, "tail":101.0, "domestic":101.0, "catsize":101.0, "class_type":101.0 }, "mean":{ "hair":0.4257425743, "feathers":0.198019802, "eggs":0.5841584158, "milk":0.4059405941, "airborne":0.2376237624, "aquatic":0.3564356436, "predator":0.5544554455, "toothed":0.603960396, "backbone":0.8217821782, "breathes":0.7920792079, "venomous":0.0792079208, "fins":0.1683168317, "legs":2.8415841584, "tail":0.7425742574, "domestic":0.1287128713, "catsize":0.4356435644, "class_type":2.8316831683 }, "std":{ "hair":0.4969212141, "feathers":0.4004947435, "eggs":0.495324676, "milk":0.4935223971, "airborne":0.4277502741, "aquatic":0.4813347778, "predator":0.4995047052, "toothed":0.4915121142, "backbone":0.3846047219, "breathes":0.4078438839, "venomous":0.2714099599, "fins":0.376013482, "legs":2.0333847313, "tail":0.4393965259, "domestic":0.3365521159, "catsize":0.4983139891, "class_type":2.1027092378 }, "min":{ "hair":0.0, "feathers":0.0, "eggs":0.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":0.0, "toothed":0.0, "backbone":0.0, "breathes":0.0, "venomous":0.0, "fins":0.0, "legs":0.0, "tail":0.0, "domestic":0.0, "catsize":0.0, "class_type":1.0 }, "25%":{ "hair":0.0, "feathers":0.0, "eggs":0.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":0.0, "toothed":0.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":2.0, "tail":0.0, "domestic":0.0, "catsize":0.0, "class_type":1.0 }, "50%":{ "hair":0.0, "feathers":0.0, "eggs":1.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":4.0, "tail":1.0, "domestic":0.0, "catsize":0.0, "class_type":2.0 }, "75%":{ "hair":1.0, "feathers":0.0, "eggs":1.0, "milk":1.0, "airborne":0.0, "aquatic":1.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":4.0, "tail":1.0, "domestic":0.0, "catsize":1.0, "class_type":4.0 }, "max":{ "hair":1.0, "feathers":1.0, "eggs":1.0, "milk":1.0, "airborne":1.0, "aquatic":1.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":1.0, "fins":1.0, "legs":8.0, "tail":1.0, "domestic":1.0, "catsize":1.0, "class_type":7.0 } } # Randome sample of 10 rows from the dataframe. df_random_sample = { "count":{ "hair":101.0, "feathers":101.0, "eggs":101.0, "milk":101.0, "airborne":101.0, "aquatic":101.0, "predator":101.0, "toothed":101.0, "backbone":101.0, "breathes":101.0, "venomous":101.0, "fins":101.0, "legs":101.0, "tail":101.0, "domestic":101.0, "catsize":101.0, "class_type":101.0 }, "mean":{ "hair":0.4257425743, "feathers":0.198019802, "eggs":0.5841584158, "milk":0.4059405941, "airborne":0.2376237624, "aquatic":0.3564356436, "predator":0.5544554455, "toothed":0.603960396, "backbone":0.8217821782, "breathes":0.7920792079, "venomous":0.0792079208, "fins":0.1683168317, "legs":2.8415841584, "tail":0.7425742574, "domestic":0.1287128713, "catsize":0.4356435644, "class_type":2.8316831683 }, "std":{ "hair":0.4969212141, "feathers":0.4004947435, "eggs":0.495324676, "milk":0.4935223971, "airborne":0.4277502741, "aquatic":0.4813347778, "predator":0.4995047052, "toothed":0.4915121142, "backbone":0.3846047219, "breathes":0.4078438839, "venomous":0.2714099599, "fins":0.376013482, "legs":2.0333847313, "tail":0.4393965259, "domestic":0.3365521159, "catsize":0.4983139891, "class_type":2.1027092378 }, "min":{ "hair":0.0, "feathers":0.0, "eggs":0.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":0.0, "toothed":0.0, "backbone":0.0, "breathes":0.0, "venomous":0.0, "fins":0.0, "legs":0.0, "tail":0.0, "domestic":0.0, "catsize":0.0, "class_type":1.0 }, "25%":{ "hair":0.0, "feathers":0.0, "eggs":0.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":0.0, "toothed":0.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":2.0, "tail":0.0, "domestic":0.0, "catsize":0.0, "class_type":1.0 }, "50%":{ "hair":0.0, "feathers":0.0, "eggs":1.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":4.0, "tail":1.0, "domestic":0.0, "catsize":0.0, "class_type":2.0 }, "75%":{ "hair":1.0, "feathers":0.0, "eggs":1.0, "milk":1.0, "airborne":0.0, "aquatic":1.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":4.0, "tail":1.0, "domestic":0.0, "catsize":1.0, "class_type":4.0 }, "max":{ "hair":1.0, "feathers":1.0, "eggs":1.0, "milk":1.0, "airborne":1.0, "aquatic":1.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":1.0, "fins":1.0, "legs":8.0, "tail":1.0, "domestic":1.0, "catsize":1.0, "class_type":7.0 } } ''' The question categories are: - boolean: Valid answers include True/False, Y/N, Yes/No (all case insensitive). - category: A value from a cell (or a substring of a cell) in the dataset. - number: A numerical value from a cell in the dataset, which may represent a computed statistic (e.g., average, maximum, minimum). - list[category]: A list containing a fixed number of categories. The expected format is: "['cat', 'dog']". Pay attention to the wording of the question to determine if uniqueness is required or if repeated values are allowed. - list[number]: Similar to list[category], but with numbers as its elements. ''' # TODO: complete the following function in one line, by completing the return statement. It should give the answer to: How many rows are there in this dataframe? def example(df: pd.DataFrame): df.columns=["A"] # Expected output type: is number, this will be checked. return df.shape[0] # It should give the answer to: What are the top 3 animal names with the most legs? If there are more than two with the lowest number go with alphabetical order # The answer should only contain python code, you are not allowed leave any TODO undone. def answer(df: pd.DataFrame): # Use df to answer: What are the top 3 animal names with the most legs? If there are more than two with the lowest number go with alphabetical order df.columns = ['animal_name', 'hair', 'feathers', 'eggs', 'milk', 'airborne', 'aquatic', 'predator', 'toothed', 'backbone', 'breathes', 'venomous', 'fins', 'legs', 'tail', 'domestic', 'catsize', 'class_type'] # Expected output type: is list[category], this will be checked. return
20250129013725
293
What are the bottom 2 animal names in terms of the number of legs? If there are more than two with the lowest number go with alphabetical order
064_Clustering
dev
list[category]
['animal_name', 'legs']
dev
# Instructions: Generate ONLY python code. Do not include explanations. # you can use pandas and numpy. Use the meta data information from df_schema, df_descprtion. import pandas as pd import numpy as np # Description of dataframe schema. df_schema = { "columns": [ { "name": "animal_name", "type": "category" }, { "name": "hair", "type": "uint8" }, { "name": "feathers", "type": "uint8" }, { "name": "eggs", "type": "uint8" }, { "name": "milk", "type": "uint8" }, { "name": "airborne", "type": "uint8" }, { "name": "aquatic", "type": "uint8" }, { "name": "predator", "type": "uint8" }, { "name": "toothed", "type": "uint8" }, { "name": "backbone", "type": "uint8" }, { "name": "breathes", "type": "uint8" }, { "name": "venomous", "type": "uint8" }, { "name": "fins", "type": "uint8" }, { "name": "legs", "type": "uint8" }, { "name": "tail", "type": "uint8" }, { "name": "domestic", "type": "uint8" }, { "name": "catsize", "type": "uint8" }, { "name": "class_type", "type": "uint8" } ] } # Description of dataframe columns. df_descrption = { "count":{ "hair":101.0, "feathers":101.0, "eggs":101.0, "milk":101.0, "airborne":101.0, "aquatic":101.0, "predator":101.0, "toothed":101.0, "backbone":101.0, "breathes":101.0, "venomous":101.0, "fins":101.0, "legs":101.0, "tail":101.0, "domestic":101.0, "catsize":101.0, "class_type":101.0 }, "mean":{ "hair":0.4257425743, "feathers":0.198019802, "eggs":0.5841584158, "milk":0.4059405941, "airborne":0.2376237624, "aquatic":0.3564356436, "predator":0.5544554455, "toothed":0.603960396, "backbone":0.8217821782, "breathes":0.7920792079, "venomous":0.0792079208, "fins":0.1683168317, "legs":2.8415841584, "tail":0.7425742574, "domestic":0.1287128713, "catsize":0.4356435644, "class_type":2.8316831683 }, "std":{ "hair":0.4969212141, "feathers":0.4004947435, "eggs":0.495324676, "milk":0.4935223971, "airborne":0.4277502741, "aquatic":0.4813347778, "predator":0.4995047052, "toothed":0.4915121142, "backbone":0.3846047219, "breathes":0.4078438839, "venomous":0.2714099599, "fins":0.376013482, "legs":2.0333847313, "tail":0.4393965259, "domestic":0.3365521159, "catsize":0.4983139891, "class_type":2.1027092378 }, "min":{ "hair":0.0, "feathers":0.0, "eggs":0.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":0.0, "toothed":0.0, "backbone":0.0, "breathes":0.0, "venomous":0.0, "fins":0.0, "legs":0.0, "tail":0.0, "domestic":0.0, "catsize":0.0, "class_type":1.0 }, "25%":{ "hair":0.0, "feathers":0.0, "eggs":0.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":0.0, "toothed":0.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":2.0, "tail":0.0, "domestic":0.0, "catsize":0.0, "class_type":1.0 }, "50%":{ "hair":0.0, "feathers":0.0, "eggs":1.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":4.0, "tail":1.0, "domestic":0.0, "catsize":0.0, "class_type":2.0 }, "75%":{ "hair":1.0, "feathers":0.0, "eggs":1.0, "milk":1.0, "airborne":0.0, "aquatic":1.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":4.0, "tail":1.0, "domestic":0.0, "catsize":1.0, "class_type":4.0 }, "max":{ "hair":1.0, "feathers":1.0, "eggs":1.0, "milk":1.0, "airborne":1.0, "aquatic":1.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":1.0, "fins":1.0, "legs":8.0, "tail":1.0, "domestic":1.0, "catsize":1.0, "class_type":7.0 } } # Randome sample of 10 rows from the dataframe. df_random_sample = { "count":{ "hair":101.0, "feathers":101.0, "eggs":101.0, "milk":101.0, "airborne":101.0, "aquatic":101.0, "predator":101.0, "toothed":101.0, "backbone":101.0, "breathes":101.0, "venomous":101.0, "fins":101.0, "legs":101.0, "tail":101.0, "domestic":101.0, "catsize":101.0, "class_type":101.0 }, "mean":{ "hair":0.4257425743, "feathers":0.198019802, "eggs":0.5841584158, "milk":0.4059405941, "airborne":0.2376237624, "aquatic":0.3564356436, "predator":0.5544554455, "toothed":0.603960396, "backbone":0.8217821782, "breathes":0.7920792079, "venomous":0.0792079208, "fins":0.1683168317, "legs":2.8415841584, "tail":0.7425742574, "domestic":0.1287128713, "catsize":0.4356435644, "class_type":2.8316831683 }, "std":{ "hair":0.4969212141, "feathers":0.4004947435, "eggs":0.495324676, "milk":0.4935223971, "airborne":0.4277502741, "aquatic":0.4813347778, "predator":0.4995047052, "toothed":0.4915121142, "backbone":0.3846047219, "breathes":0.4078438839, "venomous":0.2714099599, "fins":0.376013482, "legs":2.0333847313, "tail":0.4393965259, "domestic":0.3365521159, "catsize":0.4983139891, "class_type":2.1027092378 }, "min":{ "hair":0.0, "feathers":0.0, "eggs":0.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":0.0, "toothed":0.0, "backbone":0.0, "breathes":0.0, "venomous":0.0, "fins":0.0, "legs":0.0, "tail":0.0, "domestic":0.0, "catsize":0.0, "class_type":1.0 }, "25%":{ "hair":0.0, "feathers":0.0, "eggs":0.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":0.0, "toothed":0.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":2.0, "tail":0.0, "domestic":0.0, "catsize":0.0, "class_type":1.0 }, "50%":{ "hair":0.0, "feathers":0.0, "eggs":1.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":4.0, "tail":1.0, "domestic":0.0, "catsize":0.0, "class_type":2.0 }, "75%":{ "hair":1.0, "feathers":0.0, "eggs":1.0, "milk":1.0, "airborne":0.0, "aquatic":1.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":4.0, "tail":1.0, "domestic":0.0, "catsize":1.0, "class_type":4.0 }, "max":{ "hair":1.0, "feathers":1.0, "eggs":1.0, "milk":1.0, "airborne":1.0, "aquatic":1.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":1.0, "fins":1.0, "legs":8.0, "tail":1.0, "domestic":1.0, "catsize":1.0, "class_type":7.0 } } ''' The question categories are: - boolean: Valid answers include True/False, Y/N, Yes/No (all case insensitive). - category: A value from a cell (or a substring of a cell) in the dataset. - number: A numerical value from a cell in the dataset, which may represent a computed statistic (e.g., average, maximum, minimum). - list[category]: A list containing a fixed number of categories. The expected format is: "['cat', 'dog']". Pay attention to the wording of the question to determine if uniqueness is required or if repeated values are allowed. - list[number]: Similar to list[category], but with numbers as its elements. ''' # TODO: complete the following function in one line, by completing the return statement. It should give the answer to: How many rows are there in this dataframe? def example(df: pd.DataFrame): df.columns=["A"] # Expected output type: is number, this will be checked. return df.shape[0] # It should give the answer to: What are the bottom 2 animal names in terms of the number of legs? If there are more than two with the lowest number go with alphabetical order # The answer should only contain python code, you are not allowed leave any TODO undone. def answer(df: pd.DataFrame): # Use df to answer: What are the bottom 2 animal names in terms of the number of legs? If there are more than two with the lowest number go with alphabetical order df.columns = ['animal_name', 'hair', 'feathers', 'eggs', 'milk', 'airborne', 'aquatic', 'predator', 'toothed', 'backbone', 'breathes', 'venomous', 'fins', 'legs', 'tail', 'domestic', 'catsize', 'class_type'] # Expected output type: is list[category], this will be checked. return
20250129013725
294
What are the most common 4 class types with the most animals?
064_Clustering
dev
list[category]
['class_type']
dev
# Instructions: Generate ONLY python code. Do not include explanations. # you can use pandas and numpy. Use the meta data information from df_schema, df_descprtion. import pandas as pd import numpy as np # Description of dataframe schema. df_schema = { "columns": [ { "name": "animal_name", "type": "category" }, { "name": "hair", "type": "uint8" }, { "name": "feathers", "type": "uint8" }, { "name": "eggs", "type": "uint8" }, { "name": "milk", "type": "uint8" }, { "name": "airborne", "type": "uint8" }, { "name": "aquatic", "type": "uint8" }, { "name": "predator", "type": "uint8" }, { "name": "toothed", "type": "uint8" }, { "name": "backbone", "type": "uint8" }, { "name": "breathes", "type": "uint8" }, { "name": "venomous", "type": "uint8" }, { "name": "fins", "type": "uint8" }, { "name": "legs", "type": "uint8" }, { "name": "tail", "type": "uint8" }, { "name": "domestic", "type": "uint8" }, { "name": "catsize", "type": "uint8" }, { "name": "class_type", "type": "uint8" } ] } # Description of dataframe columns. df_descrption = { "count":{ "hair":101.0, "feathers":101.0, "eggs":101.0, "milk":101.0, "airborne":101.0, "aquatic":101.0, "predator":101.0, "toothed":101.0, "backbone":101.0, "breathes":101.0, "venomous":101.0, "fins":101.0, "legs":101.0, "tail":101.0, "domestic":101.0, "catsize":101.0, "class_type":101.0 }, "mean":{ "hair":0.4257425743, "feathers":0.198019802, "eggs":0.5841584158, "milk":0.4059405941, "airborne":0.2376237624, "aquatic":0.3564356436, "predator":0.5544554455, "toothed":0.603960396, "backbone":0.8217821782, "breathes":0.7920792079, "venomous":0.0792079208, "fins":0.1683168317, "legs":2.8415841584, "tail":0.7425742574, "domestic":0.1287128713, "catsize":0.4356435644, "class_type":2.8316831683 }, "std":{ "hair":0.4969212141, "feathers":0.4004947435, "eggs":0.495324676, "milk":0.4935223971, "airborne":0.4277502741, "aquatic":0.4813347778, "predator":0.4995047052, "toothed":0.4915121142, "backbone":0.3846047219, "breathes":0.4078438839, "venomous":0.2714099599, "fins":0.376013482, "legs":2.0333847313, "tail":0.4393965259, "domestic":0.3365521159, "catsize":0.4983139891, "class_type":2.1027092378 }, "min":{ "hair":0.0, "feathers":0.0, "eggs":0.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":0.0, "toothed":0.0, "backbone":0.0, "breathes":0.0, "venomous":0.0, "fins":0.0, "legs":0.0, "tail":0.0, "domestic":0.0, "catsize":0.0, "class_type":1.0 }, "25%":{ "hair":0.0, "feathers":0.0, "eggs":0.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":0.0, "toothed":0.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":2.0, "tail":0.0, "domestic":0.0, "catsize":0.0, "class_type":1.0 }, "50%":{ "hair":0.0, "feathers":0.0, "eggs":1.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":4.0, "tail":1.0, "domestic":0.0, "catsize":0.0, "class_type":2.0 }, "75%":{ "hair":1.0, "feathers":0.0, "eggs":1.0, "milk":1.0, "airborne":0.0, "aquatic":1.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":4.0, "tail":1.0, "domestic":0.0, "catsize":1.0, "class_type":4.0 }, "max":{ "hair":1.0, "feathers":1.0, "eggs":1.0, "milk":1.0, "airborne":1.0, "aquatic":1.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":1.0, "fins":1.0, "legs":8.0, "tail":1.0, "domestic":1.0, "catsize":1.0, "class_type":7.0 } } # Randome sample of 10 rows from the dataframe. df_random_sample = { "count":{ "hair":101.0, "feathers":101.0, "eggs":101.0, "milk":101.0, "airborne":101.0, "aquatic":101.0, "predator":101.0, "toothed":101.0, "backbone":101.0, "breathes":101.0, "venomous":101.0, "fins":101.0, "legs":101.0, "tail":101.0, "domestic":101.0, "catsize":101.0, "class_type":101.0 }, "mean":{ "hair":0.4257425743, "feathers":0.198019802, "eggs":0.5841584158, "milk":0.4059405941, "airborne":0.2376237624, "aquatic":0.3564356436, "predator":0.5544554455, "toothed":0.603960396, "backbone":0.8217821782, "breathes":0.7920792079, "venomous":0.0792079208, "fins":0.1683168317, "legs":2.8415841584, "tail":0.7425742574, "domestic":0.1287128713, "catsize":0.4356435644, "class_type":2.8316831683 }, "std":{ "hair":0.4969212141, "feathers":0.4004947435, "eggs":0.495324676, "milk":0.4935223971, "airborne":0.4277502741, "aquatic":0.4813347778, "predator":0.4995047052, "toothed":0.4915121142, "backbone":0.3846047219, "breathes":0.4078438839, "venomous":0.2714099599, "fins":0.376013482, "legs":2.0333847313, "tail":0.4393965259, "domestic":0.3365521159, "catsize":0.4983139891, "class_type":2.1027092378 }, "min":{ "hair":0.0, "feathers":0.0, "eggs":0.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":0.0, "toothed":0.0, "backbone":0.0, "breathes":0.0, "venomous":0.0, "fins":0.0, "legs":0.0, "tail":0.0, "domestic":0.0, "catsize":0.0, "class_type":1.0 }, "25%":{ "hair":0.0, "feathers":0.0, "eggs":0.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":0.0, "toothed":0.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":2.0, "tail":0.0, "domestic":0.0, "catsize":0.0, "class_type":1.0 }, "50%":{ "hair":0.0, "feathers":0.0, "eggs":1.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":4.0, "tail":1.0, "domestic":0.0, "catsize":0.0, "class_type":2.0 }, "75%":{ "hair":1.0, "feathers":0.0, "eggs":1.0, "milk":1.0, "airborne":0.0, "aquatic":1.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":4.0, "tail":1.0, "domestic":0.0, "catsize":1.0, "class_type":4.0 }, "max":{ "hair":1.0, "feathers":1.0, "eggs":1.0, "milk":1.0, "airborne":1.0, "aquatic":1.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":1.0, "fins":1.0, "legs":8.0, "tail":1.0, "domestic":1.0, "catsize":1.0, "class_type":7.0 } } ''' The question categories are: - boolean: Valid answers include True/False, Y/N, Yes/No (all case insensitive). - category: A value from a cell (or a substring of a cell) in the dataset. - number: A numerical value from a cell in the dataset, which may represent a computed statistic (e.g., average, maximum, minimum). - list[category]: A list containing a fixed number of categories. The expected format is: "['cat', 'dog']". Pay attention to the wording of the question to determine if uniqueness is required or if repeated values are allowed. - list[number]: Similar to list[category], but with numbers as its elements. ''' # TODO: complete the following function in one line, by completing the return statement. It should give the answer to: How many rows are there in this dataframe? def example(df: pd.DataFrame): df.columns=["A"] # Expected output type: is number, this will be checked. return df.shape[0] # It should give the answer to: What are the most common 4 class types with the most animals? # The answer should only contain python code, you are not allowed leave any TODO undone. def answer(df: pd.DataFrame): # Use df to answer: What are the most common 4 class types with the most animals? df.columns = ['animal_name', 'hair', 'feathers', 'eggs', 'milk', 'airborne', 'aquatic', 'predator', 'toothed', 'backbone', 'breathes', 'venomous', 'fins', 'legs', 'tail', 'domestic', 'catsize', 'class_type'] # Expected output type: is list[category], this will be checked. return
20250129013725
295
What are the least common 3 class types with the least animals?
064_Clustering
dev
list[category]
['class_type']
dev
# Instructions: Generate ONLY python code. Do not include explanations. # you can use pandas and numpy. Use the meta data information from df_schema, df_descprtion. import pandas as pd import numpy as np # Description of dataframe schema. df_schema = { "columns": [ { "name": "animal_name", "type": "category" }, { "name": "hair", "type": "uint8" }, { "name": "feathers", "type": "uint8" }, { "name": "eggs", "type": "uint8" }, { "name": "milk", "type": "uint8" }, { "name": "airborne", "type": "uint8" }, { "name": "aquatic", "type": "uint8" }, { "name": "predator", "type": "uint8" }, { "name": "toothed", "type": "uint8" }, { "name": "backbone", "type": "uint8" }, { "name": "breathes", "type": "uint8" }, { "name": "venomous", "type": "uint8" }, { "name": "fins", "type": "uint8" }, { "name": "legs", "type": "uint8" }, { "name": "tail", "type": "uint8" }, { "name": "domestic", "type": "uint8" }, { "name": "catsize", "type": "uint8" }, { "name": "class_type", "type": "uint8" } ] } # Description of dataframe columns. df_descrption = { "count":{ "hair":101.0, "feathers":101.0, "eggs":101.0, "milk":101.0, "airborne":101.0, "aquatic":101.0, "predator":101.0, "toothed":101.0, "backbone":101.0, "breathes":101.0, "venomous":101.0, "fins":101.0, "legs":101.0, "tail":101.0, "domestic":101.0, "catsize":101.0, "class_type":101.0 }, "mean":{ "hair":0.4257425743, "feathers":0.198019802, "eggs":0.5841584158, "milk":0.4059405941, "airborne":0.2376237624, "aquatic":0.3564356436, "predator":0.5544554455, "toothed":0.603960396, "backbone":0.8217821782, "breathes":0.7920792079, "venomous":0.0792079208, "fins":0.1683168317, "legs":2.8415841584, "tail":0.7425742574, "domestic":0.1287128713, "catsize":0.4356435644, "class_type":2.8316831683 }, "std":{ "hair":0.4969212141, "feathers":0.4004947435, "eggs":0.495324676, "milk":0.4935223971, "airborne":0.4277502741, "aquatic":0.4813347778, "predator":0.4995047052, "toothed":0.4915121142, "backbone":0.3846047219, "breathes":0.4078438839, "venomous":0.2714099599, "fins":0.376013482, "legs":2.0333847313, "tail":0.4393965259, "domestic":0.3365521159, "catsize":0.4983139891, "class_type":2.1027092378 }, "min":{ "hair":0.0, "feathers":0.0, "eggs":0.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":0.0, "toothed":0.0, "backbone":0.0, "breathes":0.0, "venomous":0.0, "fins":0.0, "legs":0.0, "tail":0.0, "domestic":0.0, "catsize":0.0, "class_type":1.0 }, "25%":{ "hair":0.0, "feathers":0.0, "eggs":0.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":0.0, "toothed":0.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":2.0, "tail":0.0, "domestic":0.0, "catsize":0.0, "class_type":1.0 }, "50%":{ "hair":0.0, "feathers":0.0, "eggs":1.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":4.0, "tail":1.0, "domestic":0.0, "catsize":0.0, "class_type":2.0 }, "75%":{ "hair":1.0, "feathers":0.0, "eggs":1.0, "milk":1.0, "airborne":0.0, "aquatic":1.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":4.0, "tail":1.0, "domestic":0.0, "catsize":1.0, "class_type":4.0 }, "max":{ "hair":1.0, "feathers":1.0, "eggs":1.0, "milk":1.0, "airborne":1.0, "aquatic":1.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":1.0, "fins":1.0, "legs":8.0, "tail":1.0, "domestic":1.0, "catsize":1.0, "class_type":7.0 } } # Randome sample of 10 rows from the dataframe. df_random_sample = { "count":{ "hair":101.0, "feathers":101.0, "eggs":101.0, "milk":101.0, "airborne":101.0, "aquatic":101.0, "predator":101.0, "toothed":101.0, "backbone":101.0, "breathes":101.0, "venomous":101.0, "fins":101.0, "legs":101.0, "tail":101.0, "domestic":101.0, "catsize":101.0, "class_type":101.0 }, "mean":{ "hair":0.4257425743, "feathers":0.198019802, "eggs":0.5841584158, "milk":0.4059405941, "airborne":0.2376237624, "aquatic":0.3564356436, "predator":0.5544554455, "toothed":0.603960396, "backbone":0.8217821782, "breathes":0.7920792079, "venomous":0.0792079208, "fins":0.1683168317, "legs":2.8415841584, "tail":0.7425742574, "domestic":0.1287128713, "catsize":0.4356435644, "class_type":2.8316831683 }, "std":{ "hair":0.4969212141, "feathers":0.4004947435, "eggs":0.495324676, "milk":0.4935223971, "airborne":0.4277502741, "aquatic":0.4813347778, "predator":0.4995047052, "toothed":0.4915121142, "backbone":0.3846047219, "breathes":0.4078438839, "venomous":0.2714099599, "fins":0.376013482, "legs":2.0333847313, "tail":0.4393965259, "domestic":0.3365521159, "catsize":0.4983139891, "class_type":2.1027092378 }, "min":{ "hair":0.0, "feathers":0.0, "eggs":0.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":0.0, "toothed":0.0, "backbone":0.0, "breathes":0.0, "venomous":0.0, "fins":0.0, "legs":0.0, "tail":0.0, "domestic":0.0, "catsize":0.0, "class_type":1.0 }, "25%":{ "hair":0.0, "feathers":0.0, "eggs":0.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":0.0, "toothed":0.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":2.0, "tail":0.0, "domestic":0.0, "catsize":0.0, "class_type":1.0 }, "50%":{ "hair":0.0, "feathers":0.0, "eggs":1.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":4.0, "tail":1.0, "domestic":0.0, "catsize":0.0, "class_type":2.0 }, "75%":{ "hair":1.0, "feathers":0.0, "eggs":1.0, "milk":1.0, "airborne":0.0, "aquatic":1.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":4.0, "tail":1.0, "domestic":0.0, "catsize":1.0, "class_type":4.0 }, "max":{ "hair":1.0, "feathers":1.0, "eggs":1.0, "milk":1.0, "airborne":1.0, "aquatic":1.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":1.0, "fins":1.0, "legs":8.0, "tail":1.0, "domestic":1.0, "catsize":1.0, "class_type":7.0 } } ''' The question categories are: - boolean: Valid answers include True/False, Y/N, Yes/No (all case insensitive). - category: A value from a cell (or a substring of a cell) in the dataset. - number: A numerical value from a cell in the dataset, which may represent a computed statistic (e.g., average, maximum, minimum). - list[category]: A list containing a fixed number of categories. The expected format is: "['cat', 'dog']". Pay attention to the wording of the question to determine if uniqueness is required or if repeated values are allowed. - list[number]: Similar to list[category], but with numbers as its elements. ''' # TODO: complete the following function in one line, by completing the return statement. It should give the answer to: How many rows are there in this dataframe? def example(df: pd.DataFrame): df.columns=["A"] # Expected output type: is number, this will be checked. return df.shape[0] # It should give the answer to: What are the least common 3 class types with the least animals? # The answer should only contain python code, you are not allowed leave any TODO undone. def answer(df: pd.DataFrame): # Use df to answer: What are the least common 3 class types with the least animals? df.columns = ['animal_name', 'hair', 'feathers', 'eggs', 'milk', 'airborne', 'aquatic', 'predator', 'toothed', 'backbone', 'breathes', 'venomous', 'fins', 'legs', 'tail', 'domestic', 'catsize', 'class_type'] # Expected output type: is list[category], this will be checked. return
20250129013725
296
What are the most common 5 class types with the most combined total legs?
064_Clustering
dev
list[number]
['class_type', 'legs']
dev
# Instructions: Generate ONLY python code. Do not include explanations. # you can use pandas and numpy. Use the meta data information from df_schema, df_descprtion. import pandas as pd import numpy as np # Description of dataframe schema. df_schema = { "columns": [ { "name": "animal_name", "type": "category" }, { "name": "hair", "type": "uint8" }, { "name": "feathers", "type": "uint8" }, { "name": "eggs", "type": "uint8" }, { "name": "milk", "type": "uint8" }, { "name": "airborne", "type": "uint8" }, { "name": "aquatic", "type": "uint8" }, { "name": "predator", "type": "uint8" }, { "name": "toothed", "type": "uint8" }, { "name": "backbone", "type": "uint8" }, { "name": "breathes", "type": "uint8" }, { "name": "venomous", "type": "uint8" }, { "name": "fins", "type": "uint8" }, { "name": "legs", "type": "uint8" }, { "name": "tail", "type": "uint8" }, { "name": "domestic", "type": "uint8" }, { "name": "catsize", "type": "uint8" }, { "name": "class_type", "type": "uint8" } ] } # Description of dataframe columns. df_descrption = { "count":{ "hair":101.0, "feathers":101.0, "eggs":101.0, "milk":101.0, "airborne":101.0, "aquatic":101.0, "predator":101.0, "toothed":101.0, "backbone":101.0, "breathes":101.0, "venomous":101.0, "fins":101.0, "legs":101.0, "tail":101.0, "domestic":101.0, "catsize":101.0, "class_type":101.0 }, "mean":{ "hair":0.4257425743, "feathers":0.198019802, "eggs":0.5841584158, "milk":0.4059405941, "airborne":0.2376237624, "aquatic":0.3564356436, "predator":0.5544554455, "toothed":0.603960396, "backbone":0.8217821782, "breathes":0.7920792079, "venomous":0.0792079208, "fins":0.1683168317, "legs":2.8415841584, "tail":0.7425742574, "domestic":0.1287128713, "catsize":0.4356435644, "class_type":2.8316831683 }, "std":{ "hair":0.4969212141, "feathers":0.4004947435, "eggs":0.495324676, "milk":0.4935223971, "airborne":0.4277502741, "aquatic":0.4813347778, "predator":0.4995047052, "toothed":0.4915121142, "backbone":0.3846047219, "breathes":0.4078438839, "venomous":0.2714099599, "fins":0.376013482, "legs":2.0333847313, "tail":0.4393965259, "domestic":0.3365521159, "catsize":0.4983139891, "class_type":2.1027092378 }, "min":{ "hair":0.0, "feathers":0.0, "eggs":0.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":0.0, "toothed":0.0, "backbone":0.0, "breathes":0.0, "venomous":0.0, "fins":0.0, "legs":0.0, "tail":0.0, "domestic":0.0, "catsize":0.0, "class_type":1.0 }, "25%":{ "hair":0.0, "feathers":0.0, "eggs":0.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":0.0, "toothed":0.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":2.0, "tail":0.0, "domestic":0.0, "catsize":0.0, "class_type":1.0 }, "50%":{ "hair":0.0, "feathers":0.0, "eggs":1.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":4.0, "tail":1.0, "domestic":0.0, "catsize":0.0, "class_type":2.0 }, "75%":{ "hair":1.0, "feathers":0.0, "eggs":1.0, "milk":1.0, "airborne":0.0, "aquatic":1.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":4.0, "tail":1.0, "domestic":0.0, "catsize":1.0, "class_type":4.0 }, "max":{ "hair":1.0, "feathers":1.0, "eggs":1.0, "milk":1.0, "airborne":1.0, "aquatic":1.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":1.0, "fins":1.0, "legs":8.0, "tail":1.0, "domestic":1.0, "catsize":1.0, "class_type":7.0 } } # Randome sample of 10 rows from the dataframe. df_random_sample = { "count":{ "hair":101.0, "feathers":101.0, "eggs":101.0, "milk":101.0, "airborne":101.0, "aquatic":101.0, "predator":101.0, "toothed":101.0, "backbone":101.0, "breathes":101.0, "venomous":101.0, "fins":101.0, "legs":101.0, "tail":101.0, "domestic":101.0, "catsize":101.0, "class_type":101.0 }, "mean":{ "hair":0.4257425743, "feathers":0.198019802, "eggs":0.5841584158, "milk":0.4059405941, "airborne":0.2376237624, "aquatic":0.3564356436, "predator":0.5544554455, "toothed":0.603960396, "backbone":0.8217821782, "breathes":0.7920792079, "venomous":0.0792079208, "fins":0.1683168317, "legs":2.8415841584, "tail":0.7425742574, "domestic":0.1287128713, "catsize":0.4356435644, "class_type":2.8316831683 }, "std":{ "hair":0.4969212141, "feathers":0.4004947435, "eggs":0.495324676, "milk":0.4935223971, "airborne":0.4277502741, "aquatic":0.4813347778, "predator":0.4995047052, "toothed":0.4915121142, "backbone":0.3846047219, "breathes":0.4078438839, "venomous":0.2714099599, "fins":0.376013482, "legs":2.0333847313, "tail":0.4393965259, "domestic":0.3365521159, "catsize":0.4983139891, "class_type":2.1027092378 }, "min":{ "hair":0.0, "feathers":0.0, "eggs":0.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":0.0, "toothed":0.0, "backbone":0.0, "breathes":0.0, "venomous":0.0, "fins":0.0, "legs":0.0, "tail":0.0, "domestic":0.0, "catsize":0.0, "class_type":1.0 }, "25%":{ "hair":0.0, "feathers":0.0, "eggs":0.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":0.0, "toothed":0.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":2.0, "tail":0.0, "domestic":0.0, "catsize":0.0, "class_type":1.0 }, "50%":{ "hair":0.0, "feathers":0.0, "eggs":1.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":4.0, "tail":1.0, "domestic":0.0, "catsize":0.0, "class_type":2.0 }, "75%":{ "hair":1.0, "feathers":0.0, "eggs":1.0, "milk":1.0, "airborne":0.0, "aquatic":1.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":4.0, "tail":1.0, "domestic":0.0, "catsize":1.0, "class_type":4.0 }, "max":{ "hair":1.0, "feathers":1.0, "eggs":1.0, "milk":1.0, "airborne":1.0, "aquatic":1.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":1.0, "fins":1.0, "legs":8.0, "tail":1.0, "domestic":1.0, "catsize":1.0, "class_type":7.0 } } ''' The question categories are: - boolean: Valid answers include True/False, Y/N, Yes/No (all case insensitive). - category: A value from a cell (or a substring of a cell) in the dataset. - number: A numerical value from a cell in the dataset, which may represent a computed statistic (e.g., average, maximum, minimum). - list[category]: A list containing a fixed number of categories. The expected format is: "['cat', 'dog']". Pay attention to the wording of the question to determine if uniqueness is required or if repeated values are allowed. - list[number]: Similar to list[category], but with numbers as its elements. ''' # TODO: complete the following function in one line, by completing the return statement. It should give the answer to: How many rows are there in this dataframe? def example(df: pd.DataFrame): df.columns=["A"] # Expected output type: is number, this will be checked. return df.shape[0] # It should give the answer to: What are the most common 5 class types with the most combined total legs? # The answer should only contain python code, you are not allowed leave any TODO undone. def answer(df: pd.DataFrame): # Use df to answer: What are the most common 5 class types with the most combined total legs? df.columns = ['animal_name', 'hair', 'feathers', 'eggs', 'milk', 'airborne', 'aquatic', 'predator', 'toothed', 'backbone', 'breathes', 'venomous', 'fins', 'legs', 'tail', 'domestic', 'catsize', 'class_type'] # Expected output type: is list[number], this will be checked. return
20250129013725
297
What are the bottom 4 class types with the least combined total legs?
064_Clustering
dev
list[number]
['class_type', 'legs']
dev
# Instructions: Generate ONLY python code. Do not include explanations. # you can use pandas and numpy. Use the meta data information from df_schema, df_descprtion. import pandas as pd import numpy as np # Description of dataframe schema. df_schema = { "columns": [ { "name": "animal_name", "type": "category" }, { "name": "hair", "type": "uint8" }, { "name": "feathers", "type": "uint8" }, { "name": "eggs", "type": "uint8" }, { "name": "milk", "type": "uint8" }, { "name": "airborne", "type": "uint8" }, { "name": "aquatic", "type": "uint8" }, { "name": "predator", "type": "uint8" }, { "name": "toothed", "type": "uint8" }, { "name": "backbone", "type": "uint8" }, { "name": "breathes", "type": "uint8" }, { "name": "venomous", "type": "uint8" }, { "name": "fins", "type": "uint8" }, { "name": "legs", "type": "uint8" }, { "name": "tail", "type": "uint8" }, { "name": "domestic", "type": "uint8" }, { "name": "catsize", "type": "uint8" }, { "name": "class_type", "type": "uint8" } ] } # Description of dataframe columns. df_descrption = { "count":{ "hair":101.0, "feathers":101.0, "eggs":101.0, "milk":101.0, "airborne":101.0, "aquatic":101.0, "predator":101.0, "toothed":101.0, "backbone":101.0, "breathes":101.0, "venomous":101.0, "fins":101.0, "legs":101.0, "tail":101.0, "domestic":101.0, "catsize":101.0, "class_type":101.0 }, "mean":{ "hair":0.4257425743, "feathers":0.198019802, "eggs":0.5841584158, "milk":0.4059405941, "airborne":0.2376237624, "aquatic":0.3564356436, "predator":0.5544554455, "toothed":0.603960396, "backbone":0.8217821782, "breathes":0.7920792079, "venomous":0.0792079208, "fins":0.1683168317, "legs":2.8415841584, "tail":0.7425742574, "domestic":0.1287128713, "catsize":0.4356435644, "class_type":2.8316831683 }, "std":{ "hair":0.4969212141, "feathers":0.4004947435, "eggs":0.495324676, "milk":0.4935223971, "airborne":0.4277502741, "aquatic":0.4813347778, "predator":0.4995047052, "toothed":0.4915121142, "backbone":0.3846047219, "breathes":0.4078438839, "venomous":0.2714099599, "fins":0.376013482, "legs":2.0333847313, "tail":0.4393965259, "domestic":0.3365521159, "catsize":0.4983139891, "class_type":2.1027092378 }, "min":{ "hair":0.0, "feathers":0.0, "eggs":0.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":0.0, "toothed":0.0, "backbone":0.0, "breathes":0.0, "venomous":0.0, "fins":0.0, "legs":0.0, "tail":0.0, "domestic":0.0, "catsize":0.0, "class_type":1.0 }, "25%":{ "hair":0.0, "feathers":0.0, "eggs":0.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":0.0, "toothed":0.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":2.0, "tail":0.0, "domestic":0.0, "catsize":0.0, "class_type":1.0 }, "50%":{ "hair":0.0, "feathers":0.0, "eggs":1.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":4.0, "tail":1.0, "domestic":0.0, "catsize":0.0, "class_type":2.0 }, "75%":{ "hair":1.0, "feathers":0.0, "eggs":1.0, "milk":1.0, "airborne":0.0, "aquatic":1.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":4.0, "tail":1.0, "domestic":0.0, "catsize":1.0, "class_type":4.0 }, "max":{ "hair":1.0, "feathers":1.0, "eggs":1.0, "milk":1.0, "airborne":1.0, "aquatic":1.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":1.0, "fins":1.0, "legs":8.0, "tail":1.0, "domestic":1.0, "catsize":1.0, "class_type":7.0 } } # Randome sample of 10 rows from the dataframe. df_random_sample = { "count":{ "hair":101.0, "feathers":101.0, "eggs":101.0, "milk":101.0, "airborne":101.0, "aquatic":101.0, "predator":101.0, "toothed":101.0, "backbone":101.0, "breathes":101.0, "venomous":101.0, "fins":101.0, "legs":101.0, "tail":101.0, "domestic":101.0, "catsize":101.0, "class_type":101.0 }, "mean":{ "hair":0.4257425743, "feathers":0.198019802, "eggs":0.5841584158, "milk":0.4059405941, "airborne":0.2376237624, "aquatic":0.3564356436, "predator":0.5544554455, "toothed":0.603960396, "backbone":0.8217821782, "breathes":0.7920792079, "venomous":0.0792079208, "fins":0.1683168317, "legs":2.8415841584, "tail":0.7425742574, "domestic":0.1287128713, "catsize":0.4356435644, "class_type":2.8316831683 }, "std":{ "hair":0.4969212141, "feathers":0.4004947435, "eggs":0.495324676, "milk":0.4935223971, "airborne":0.4277502741, "aquatic":0.4813347778, "predator":0.4995047052, "toothed":0.4915121142, "backbone":0.3846047219, "breathes":0.4078438839, "venomous":0.2714099599, "fins":0.376013482, "legs":2.0333847313, "tail":0.4393965259, "domestic":0.3365521159, "catsize":0.4983139891, "class_type":2.1027092378 }, "min":{ "hair":0.0, "feathers":0.0, "eggs":0.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":0.0, "toothed":0.0, "backbone":0.0, "breathes":0.0, "venomous":0.0, "fins":0.0, "legs":0.0, "tail":0.0, "domestic":0.0, "catsize":0.0, "class_type":1.0 }, "25%":{ "hair":0.0, "feathers":0.0, "eggs":0.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":0.0, "toothed":0.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":2.0, "tail":0.0, "domestic":0.0, "catsize":0.0, "class_type":1.0 }, "50%":{ "hair":0.0, "feathers":0.0, "eggs":1.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":4.0, "tail":1.0, "domestic":0.0, "catsize":0.0, "class_type":2.0 }, "75%":{ "hair":1.0, "feathers":0.0, "eggs":1.0, "milk":1.0, "airborne":0.0, "aquatic":1.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":4.0, "tail":1.0, "domestic":0.0, "catsize":1.0, "class_type":4.0 }, "max":{ "hair":1.0, "feathers":1.0, "eggs":1.0, "milk":1.0, "airborne":1.0, "aquatic":1.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":1.0, "fins":1.0, "legs":8.0, "tail":1.0, "domestic":1.0, "catsize":1.0, "class_type":7.0 } } ''' The question categories are: - boolean: Valid answers include True/False, Y/N, Yes/No (all case insensitive). - category: A value from a cell (or a substring of a cell) in the dataset. - number: A numerical value from a cell in the dataset, which may represent a computed statistic (e.g., average, maximum, minimum). - list[category]: A list containing a fixed number of categories. The expected format is: "['cat', 'dog']". Pay attention to the wording of the question to determine if uniqueness is required or if repeated values are allowed. - list[number]: Similar to list[category], but with numbers as its elements. ''' # TODO: complete the following function in one line, by completing the return statement. It should give the answer to: How many rows are there in this dataframe? def example(df: pd.DataFrame): df.columns=["A"] # Expected output type: is number, this will be checked. return df.shape[0] # It should give the answer to: What are the bottom 4 class types with the least combined total legs? # The answer should only contain python code, you are not allowed leave any TODO undone. def answer(df: pd.DataFrame): # Use df to answer: What are the bottom 4 class types with the least combined total legs? df.columns = ['animal_name', 'hair', 'feathers', 'eggs', 'milk', 'airborne', 'aquatic', 'predator', 'toothed', 'backbone', 'breathes', 'venomous', 'fins', 'legs', 'tail', 'domestic', 'catsize', 'class_type'] # Expected output type: is list[number], this will be checked. return
20250129013725
298
What are the most common 4 numbers of legs that animals have?
064_Clustering
dev
list[number]
['legs']
dev
# Instructions: Generate ONLY python code. Do not include explanations. # you can use pandas and numpy. Use the meta data information from df_schema, df_descprtion. import pandas as pd import numpy as np # Description of dataframe schema. df_schema = { "columns": [ { "name": "animal_name", "type": "category" }, { "name": "hair", "type": "uint8" }, { "name": "feathers", "type": "uint8" }, { "name": "eggs", "type": "uint8" }, { "name": "milk", "type": "uint8" }, { "name": "airborne", "type": "uint8" }, { "name": "aquatic", "type": "uint8" }, { "name": "predator", "type": "uint8" }, { "name": "toothed", "type": "uint8" }, { "name": "backbone", "type": "uint8" }, { "name": "breathes", "type": "uint8" }, { "name": "venomous", "type": "uint8" }, { "name": "fins", "type": "uint8" }, { "name": "legs", "type": "uint8" }, { "name": "tail", "type": "uint8" }, { "name": "domestic", "type": "uint8" }, { "name": "catsize", "type": "uint8" }, { "name": "class_type", "type": "uint8" } ] } # Description of dataframe columns. df_descrption = { "count":{ "hair":101.0, "feathers":101.0, "eggs":101.0, "milk":101.0, "airborne":101.0, "aquatic":101.0, "predator":101.0, "toothed":101.0, "backbone":101.0, "breathes":101.0, "venomous":101.0, "fins":101.0, "legs":101.0, "tail":101.0, "domestic":101.0, "catsize":101.0, "class_type":101.0 }, "mean":{ "hair":0.4257425743, "feathers":0.198019802, "eggs":0.5841584158, "milk":0.4059405941, "airborne":0.2376237624, "aquatic":0.3564356436, "predator":0.5544554455, "toothed":0.603960396, "backbone":0.8217821782, "breathes":0.7920792079, "venomous":0.0792079208, "fins":0.1683168317, "legs":2.8415841584, "tail":0.7425742574, "domestic":0.1287128713, "catsize":0.4356435644, "class_type":2.8316831683 }, "std":{ "hair":0.4969212141, "feathers":0.4004947435, "eggs":0.495324676, "milk":0.4935223971, "airborne":0.4277502741, "aquatic":0.4813347778, "predator":0.4995047052, "toothed":0.4915121142, "backbone":0.3846047219, "breathes":0.4078438839, "venomous":0.2714099599, "fins":0.376013482, "legs":2.0333847313, "tail":0.4393965259, "domestic":0.3365521159, "catsize":0.4983139891, "class_type":2.1027092378 }, "min":{ "hair":0.0, "feathers":0.0, "eggs":0.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":0.0, "toothed":0.0, "backbone":0.0, "breathes":0.0, "venomous":0.0, "fins":0.0, "legs":0.0, "tail":0.0, "domestic":0.0, "catsize":0.0, "class_type":1.0 }, "25%":{ "hair":0.0, "feathers":0.0, "eggs":0.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":0.0, "toothed":0.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":2.0, "tail":0.0, "domestic":0.0, "catsize":0.0, "class_type":1.0 }, "50%":{ "hair":0.0, "feathers":0.0, "eggs":1.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":4.0, "tail":1.0, "domestic":0.0, "catsize":0.0, "class_type":2.0 }, "75%":{ "hair":1.0, "feathers":0.0, "eggs":1.0, "milk":1.0, "airborne":0.0, "aquatic":1.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":4.0, "tail":1.0, "domestic":0.0, "catsize":1.0, "class_type":4.0 }, "max":{ "hair":1.0, "feathers":1.0, "eggs":1.0, "milk":1.0, "airborne":1.0, "aquatic":1.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":1.0, "fins":1.0, "legs":8.0, "tail":1.0, "domestic":1.0, "catsize":1.0, "class_type":7.0 } } # Randome sample of 10 rows from the dataframe. df_random_sample = { "count":{ "hair":101.0, "feathers":101.0, "eggs":101.0, "milk":101.0, "airborne":101.0, "aquatic":101.0, "predator":101.0, "toothed":101.0, "backbone":101.0, "breathes":101.0, "venomous":101.0, "fins":101.0, "legs":101.0, "tail":101.0, "domestic":101.0, "catsize":101.0, "class_type":101.0 }, "mean":{ "hair":0.4257425743, "feathers":0.198019802, "eggs":0.5841584158, "milk":0.4059405941, "airborne":0.2376237624, "aquatic":0.3564356436, "predator":0.5544554455, "toothed":0.603960396, "backbone":0.8217821782, "breathes":0.7920792079, "venomous":0.0792079208, "fins":0.1683168317, "legs":2.8415841584, "tail":0.7425742574, "domestic":0.1287128713, "catsize":0.4356435644, "class_type":2.8316831683 }, "std":{ "hair":0.4969212141, "feathers":0.4004947435, "eggs":0.495324676, "milk":0.4935223971, "airborne":0.4277502741, "aquatic":0.4813347778, "predator":0.4995047052, "toothed":0.4915121142, "backbone":0.3846047219, "breathes":0.4078438839, "venomous":0.2714099599, "fins":0.376013482, "legs":2.0333847313, "tail":0.4393965259, "domestic":0.3365521159, "catsize":0.4983139891, "class_type":2.1027092378 }, "min":{ "hair":0.0, "feathers":0.0, "eggs":0.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":0.0, "toothed":0.0, "backbone":0.0, "breathes":0.0, "venomous":0.0, "fins":0.0, "legs":0.0, "tail":0.0, "domestic":0.0, "catsize":0.0, "class_type":1.0 }, "25%":{ "hair":0.0, "feathers":0.0, "eggs":0.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":0.0, "toothed":0.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":2.0, "tail":0.0, "domestic":0.0, "catsize":0.0, "class_type":1.0 }, "50%":{ "hair":0.0, "feathers":0.0, "eggs":1.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":4.0, "tail":1.0, "domestic":0.0, "catsize":0.0, "class_type":2.0 }, "75%":{ "hair":1.0, "feathers":0.0, "eggs":1.0, "milk":1.0, "airborne":0.0, "aquatic":1.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":4.0, "tail":1.0, "domestic":0.0, "catsize":1.0, "class_type":4.0 }, "max":{ "hair":1.0, "feathers":1.0, "eggs":1.0, "milk":1.0, "airborne":1.0, "aquatic":1.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":1.0, "fins":1.0, "legs":8.0, "tail":1.0, "domestic":1.0, "catsize":1.0, "class_type":7.0 } } ''' The question categories are: - boolean: Valid answers include True/False, Y/N, Yes/No (all case insensitive). - category: A value from a cell (or a substring of a cell) in the dataset. - number: A numerical value from a cell in the dataset, which may represent a computed statistic (e.g., average, maximum, minimum). - list[category]: A list containing a fixed number of categories. The expected format is: "['cat', 'dog']". Pay attention to the wording of the question to determine if uniqueness is required or if repeated values are allowed. - list[number]: Similar to list[category], but with numbers as its elements. ''' # TODO: complete the following function in one line, by completing the return statement. It should give the answer to: How many rows are there in this dataframe? def example(df: pd.DataFrame): df.columns=["A"] # Expected output type: is number, this will be checked. return df.shape[0] # It should give the answer to: What are the most common 4 numbers of legs that animals have? # The answer should only contain python code, you are not allowed leave any TODO undone. def answer(df: pd.DataFrame): # Use df to answer: What are the most common 4 numbers of legs that animals have? df.columns = ['animal_name', 'hair', 'feathers', 'eggs', 'milk', 'airborne', 'aquatic', 'predator', 'toothed', 'backbone', 'breathes', 'venomous', 'fins', 'legs', 'tail', 'domestic', 'catsize', 'class_type'] # Expected output type: is list[number], this will be checked. return
20250129013726
299
What are the least common 3 numbers of legs that animals have?
064_Clustering
dev
list[number]
['legs']
dev
# Instructions: Generate ONLY python code. Do not include explanations. # you can use pandas and numpy. Use the meta data information from df_schema, df_descprtion. import pandas as pd import numpy as np # Description of dataframe schema. df_schema = { "columns": [ { "name": "animal_name", "type": "category" }, { "name": "hair", "type": "uint8" }, { "name": "feathers", "type": "uint8" }, { "name": "eggs", "type": "uint8" }, { "name": "milk", "type": "uint8" }, { "name": "airborne", "type": "uint8" }, { "name": "aquatic", "type": "uint8" }, { "name": "predator", "type": "uint8" }, { "name": "toothed", "type": "uint8" }, { "name": "backbone", "type": "uint8" }, { "name": "breathes", "type": "uint8" }, { "name": "venomous", "type": "uint8" }, { "name": "fins", "type": "uint8" }, { "name": "legs", "type": "uint8" }, { "name": "tail", "type": "uint8" }, { "name": "domestic", "type": "uint8" }, { "name": "catsize", "type": "uint8" }, { "name": "class_type", "type": "uint8" } ] } # Description of dataframe columns. df_descrption = { "count":{ "hair":101.0, "feathers":101.0, "eggs":101.0, "milk":101.0, "airborne":101.0, "aquatic":101.0, "predator":101.0, "toothed":101.0, "backbone":101.0, "breathes":101.0, "venomous":101.0, "fins":101.0, "legs":101.0, "tail":101.0, "domestic":101.0, "catsize":101.0, "class_type":101.0 }, "mean":{ "hair":0.4257425743, "feathers":0.198019802, "eggs":0.5841584158, "milk":0.4059405941, "airborne":0.2376237624, "aquatic":0.3564356436, "predator":0.5544554455, "toothed":0.603960396, "backbone":0.8217821782, "breathes":0.7920792079, "venomous":0.0792079208, "fins":0.1683168317, "legs":2.8415841584, "tail":0.7425742574, "domestic":0.1287128713, "catsize":0.4356435644, "class_type":2.8316831683 }, "std":{ "hair":0.4969212141, "feathers":0.4004947435, "eggs":0.495324676, "milk":0.4935223971, "airborne":0.4277502741, "aquatic":0.4813347778, "predator":0.4995047052, "toothed":0.4915121142, "backbone":0.3846047219, "breathes":0.4078438839, "venomous":0.2714099599, "fins":0.376013482, "legs":2.0333847313, "tail":0.4393965259, "domestic":0.3365521159, "catsize":0.4983139891, "class_type":2.1027092378 }, "min":{ "hair":0.0, "feathers":0.0, "eggs":0.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":0.0, "toothed":0.0, "backbone":0.0, "breathes":0.0, "venomous":0.0, "fins":0.0, "legs":0.0, "tail":0.0, "domestic":0.0, "catsize":0.0, "class_type":1.0 }, "25%":{ "hair":0.0, "feathers":0.0, "eggs":0.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":0.0, "toothed":0.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":2.0, "tail":0.0, "domestic":0.0, "catsize":0.0, "class_type":1.0 }, "50%":{ "hair":0.0, "feathers":0.0, "eggs":1.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":4.0, "tail":1.0, "domestic":0.0, "catsize":0.0, "class_type":2.0 }, "75%":{ "hair":1.0, "feathers":0.0, "eggs":1.0, "milk":1.0, "airborne":0.0, "aquatic":1.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":4.0, "tail":1.0, "domestic":0.0, "catsize":1.0, "class_type":4.0 }, "max":{ "hair":1.0, "feathers":1.0, "eggs":1.0, "milk":1.0, "airborne":1.0, "aquatic":1.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":1.0, "fins":1.0, "legs":8.0, "tail":1.0, "domestic":1.0, "catsize":1.0, "class_type":7.0 } } # Randome sample of 10 rows from the dataframe. df_random_sample = { "count":{ "hair":101.0, "feathers":101.0, "eggs":101.0, "milk":101.0, "airborne":101.0, "aquatic":101.0, "predator":101.0, "toothed":101.0, "backbone":101.0, "breathes":101.0, "venomous":101.0, "fins":101.0, "legs":101.0, "tail":101.0, "domestic":101.0, "catsize":101.0, "class_type":101.0 }, "mean":{ "hair":0.4257425743, "feathers":0.198019802, "eggs":0.5841584158, "milk":0.4059405941, "airborne":0.2376237624, "aquatic":0.3564356436, "predator":0.5544554455, "toothed":0.603960396, "backbone":0.8217821782, "breathes":0.7920792079, "venomous":0.0792079208, "fins":0.1683168317, "legs":2.8415841584, "tail":0.7425742574, "domestic":0.1287128713, "catsize":0.4356435644, "class_type":2.8316831683 }, "std":{ "hair":0.4969212141, "feathers":0.4004947435, "eggs":0.495324676, "milk":0.4935223971, "airborne":0.4277502741, "aquatic":0.4813347778, "predator":0.4995047052, "toothed":0.4915121142, "backbone":0.3846047219, "breathes":0.4078438839, "venomous":0.2714099599, "fins":0.376013482, "legs":2.0333847313, "tail":0.4393965259, "domestic":0.3365521159, "catsize":0.4983139891, "class_type":2.1027092378 }, "min":{ "hair":0.0, "feathers":0.0, "eggs":0.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":0.0, "toothed":0.0, "backbone":0.0, "breathes":0.0, "venomous":0.0, "fins":0.0, "legs":0.0, "tail":0.0, "domestic":0.0, "catsize":0.0, "class_type":1.0 }, "25%":{ "hair":0.0, "feathers":0.0, "eggs":0.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":0.0, "toothed":0.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":2.0, "tail":0.0, "domestic":0.0, "catsize":0.0, "class_type":1.0 }, "50%":{ "hair":0.0, "feathers":0.0, "eggs":1.0, "milk":0.0, "airborne":0.0, "aquatic":0.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":4.0, "tail":1.0, "domestic":0.0, "catsize":0.0, "class_type":2.0 }, "75%":{ "hair":1.0, "feathers":0.0, "eggs":1.0, "milk":1.0, "airborne":0.0, "aquatic":1.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":0.0, "fins":0.0, "legs":4.0, "tail":1.0, "domestic":0.0, "catsize":1.0, "class_type":4.0 }, "max":{ "hair":1.0, "feathers":1.0, "eggs":1.0, "milk":1.0, "airborne":1.0, "aquatic":1.0, "predator":1.0, "toothed":1.0, "backbone":1.0, "breathes":1.0, "venomous":1.0, "fins":1.0, "legs":8.0, "tail":1.0, "domestic":1.0, "catsize":1.0, "class_type":7.0 } } ''' The question categories are: - boolean: Valid answers include True/False, Y/N, Yes/No (all case insensitive). - category: A value from a cell (or a substring of a cell) in the dataset. - number: A numerical value from a cell in the dataset, which may represent a computed statistic (e.g., average, maximum, minimum). - list[category]: A list containing a fixed number of categories. The expected format is: "['cat', 'dog']". Pay attention to the wording of the question to determine if uniqueness is required or if repeated values are allowed. - list[number]: Similar to list[category], but with numbers as its elements. ''' # TODO: complete the following function in one line, by completing the return statement. It should give the answer to: How many rows are there in this dataframe? def example(df: pd.DataFrame): df.columns=["A"] # Expected output type: is number, this will be checked. return df.shape[0] # It should give the answer to: What are the least common 3 numbers of legs that animals have? # The answer should only contain python code, you are not allowed leave any TODO undone. def answer(df: pd.DataFrame): # Use df to answer: What are the least common 3 numbers of legs that animals have? df.columns = ['animal_name', 'hair', 'feathers', 'eggs', 'milk', 'airborne', 'aquatic', 'predator', 'toothed', 'backbone', 'breathes', 'venomous', 'fins', 'legs', 'tail', 'domestic', 'catsize', 'class_type'] # Expected output type: is list[number], this will be checked. return
20250129013726