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 |
---|---|---|---|---|---|---|---|---|
0 | Is the most favorited author mainly communicating in Spanish? | 050_ING | dev | boolean | ['favorites', '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": "int64"
},
{
"name": "author_name",
"type": "category"
},
{
"name": "author_handler",
"type": "category"
},
{
"name": "author_avatar",
"type": "category"
},
{
"name": "lang",
"type": "category"
},
{
"name": "type",
"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": "uint8"
},
{
"name": "favorites",
"type": "uint8"
},
{
"name": "links",
"type": "object"
},
{
"name": "links_first",
"type": "category"
},
{
"name": "image_links",
"type": "object"
},
{
"name": "image_links_first",
"type": "category"
},
{
"name": "rp_user_id",
"type": "float64"
},
{
"name": "rp_user_name",
"type": "category"
},
{
"name": "location",
"type": "category"
},
{
"name": "tweet_link",
"type": "category"
},
{
"name": "search",
"type": "category"
}
]
}
# Description of dataframe columns.
df_descrption = {
"count":{
"id":7244.0,
"author_id":7244.0,
"retweets":7244.0,
"favorites":7244.0,
"rp_user_id":4094.0
},
"mean":{
"id":1.129999764e+18,
"author_id":1.456169002e+17,
"retweets":0.1715902816,
"favorites":0.6188569851,
"rp_user_id":270815203.0
},
"std":{
"id":2.920544101e+16,
"author_id":3.490773128e+17,
"retweets":0.7395750951,
"favorites":1.8434020668,
"rp_user_id":0.0
},
"min":{
"id":1.079908205e+18,
"author_id":7007.0,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"25%":{
"id":1.10505894e+18,
"author_id":140041809.75,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"50%":{
"id":1.124196559e+18,
"author_id":318183125.5,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"75%":{
"id":1.158378457e+18,
"author_id":1901654083.0,
"retweets":0.0,
"favorites":1.0,
"rp_user_id":270815203.0
},
"max":{
"id":1.176868218e+18,
"author_id":1.175435395e+18,
"retweets":17.0,
"favorites":41.0,
"rp_user_id":270815203.0
}
}
# Randome sample of 10 rows from the dataframe.
df_random_sample = {
"count":{
"id":7244.0,
"author_id":7244.0,
"retweets":7244.0,
"favorites":7244.0,
"rp_user_id":4094.0
},
"mean":{
"id":1.129999764e+18,
"author_id":1.456169002e+17,
"retweets":0.1715902816,
"favorites":0.6188569851,
"rp_user_id":270815203.0
},
"std":{
"id":2.920544101e+16,
"author_id":3.490773128e+17,
"retweets":0.7395750951,
"favorites":1.8434020668,
"rp_user_id":0.0
},
"min":{
"id":1.079908205e+18,
"author_id":7007.0,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"25%":{
"id":1.10505894e+18,
"author_id":140041809.75,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"50%":{
"id":1.124196559e+18,
"author_id":318183125.5,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"75%":{
"id":1.158378457e+18,
"author_id":1901654083.0,
"retweets":0.0,
"favorites":1.0,
"rp_user_id":270815203.0
},
"max":{
"id":1.176868218e+18,
"author_id":1.175435395e+18,
"retweets":17.0,
"favorites":41.0,
"rp_user_id":270815203.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 the most favorited author mainly communicating in Spanish?
# 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 the most favorited author mainly communicating in Spanish?
df.columns = ['id', 'author_id', 'author_name', 'author_handler', 'author_avatar', 'lang', 'type', 'text', 'date', 'mention_ids', 'mention_names', 'retweets', 'favorites', 'links', 'links_first', 'image_links', 'image_links_first', 'rp_user_id', 'rp_user_name', 'location', 'tweet_link', 'search']
# Expected output type: is boolean, this will be checked.
return | 20250129013714 |
1 | Does the author with the longest name post mainly original content? | 050_ING | dev | boolean | ['author_name', '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": "id",
"type": "int64"
},
{
"name": "author_id",
"type": "int64"
},
{
"name": "author_name",
"type": "category"
},
{
"name": "author_handler",
"type": "category"
},
{
"name": "author_avatar",
"type": "category"
},
{
"name": "lang",
"type": "category"
},
{
"name": "type",
"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": "uint8"
},
{
"name": "favorites",
"type": "uint8"
},
{
"name": "links",
"type": "object"
},
{
"name": "links_first",
"type": "category"
},
{
"name": "image_links",
"type": "object"
},
{
"name": "image_links_first",
"type": "category"
},
{
"name": "rp_user_id",
"type": "float64"
},
{
"name": "rp_user_name",
"type": "category"
},
{
"name": "location",
"type": "category"
},
{
"name": "tweet_link",
"type": "category"
},
{
"name": "search",
"type": "category"
}
]
}
# Description of dataframe columns.
df_descrption = {
"count":{
"id":7244.0,
"author_id":7244.0,
"retweets":7244.0,
"favorites":7244.0,
"rp_user_id":4094.0
},
"mean":{
"id":1.129999764e+18,
"author_id":1.456169002e+17,
"retweets":0.1715902816,
"favorites":0.6188569851,
"rp_user_id":270815203.0
},
"std":{
"id":2.920544101e+16,
"author_id":3.490773128e+17,
"retweets":0.7395750951,
"favorites":1.8434020668,
"rp_user_id":0.0
},
"min":{
"id":1.079908205e+18,
"author_id":7007.0,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"25%":{
"id":1.10505894e+18,
"author_id":140041809.75,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"50%":{
"id":1.124196559e+18,
"author_id":318183125.5,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"75%":{
"id":1.158378457e+18,
"author_id":1901654083.0,
"retweets":0.0,
"favorites":1.0,
"rp_user_id":270815203.0
},
"max":{
"id":1.176868218e+18,
"author_id":1.175435395e+18,
"retweets":17.0,
"favorites":41.0,
"rp_user_id":270815203.0
}
}
# Randome sample of 10 rows from the dataframe.
df_random_sample = {
"count":{
"id":7244.0,
"author_id":7244.0,
"retweets":7244.0,
"favorites":7244.0,
"rp_user_id":4094.0
},
"mean":{
"id":1.129999764e+18,
"author_id":1.456169002e+17,
"retweets":0.1715902816,
"favorites":0.6188569851,
"rp_user_id":270815203.0
},
"std":{
"id":2.920544101e+16,
"author_id":3.490773128e+17,
"retweets":0.7395750951,
"favorites":1.8434020668,
"rp_user_id":0.0
},
"min":{
"id":1.079908205e+18,
"author_id":7007.0,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"25%":{
"id":1.10505894e+18,
"author_id":140041809.75,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"50%":{
"id":1.124196559e+18,
"author_id":318183125.5,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"75%":{
"id":1.158378457e+18,
"author_id":1901654083.0,
"retweets":0.0,
"favorites":1.0,
"rp_user_id":270815203.0
},
"max":{
"id":1.176868218e+18,
"author_id":1.175435395e+18,
"retweets":17.0,
"favorites":41.0,
"rp_user_id":270815203.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 the author with the longest name post mainly original content?
# 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 the author with the longest name post mainly original content?
df.columns = ['id', 'author_id', 'author_name', 'author_handler', 'author_avatar', 'lang', 'type', 'text', 'date', 'mention_ids', 'mention_names', 'retweets', 'favorites', 'links', 'links_first', 'image_links', 'image_links_first', 'rp_user_id', 'rp_user_name', 'location', 'tweet_link', 'search']
# Expected output type: is boolean, this will be checked.
return | 20250129013714 |
2 | Is there an author who received no retweets for any of their posts? | 050_ING | dev | boolean | ['author_name', '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": "int64"
},
{
"name": "author_name",
"type": "category"
},
{
"name": "author_handler",
"type": "category"
},
{
"name": "author_avatar",
"type": "category"
},
{
"name": "lang",
"type": "category"
},
{
"name": "type",
"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": "uint8"
},
{
"name": "favorites",
"type": "uint8"
},
{
"name": "links",
"type": "object"
},
{
"name": "links_first",
"type": "category"
},
{
"name": "image_links",
"type": "object"
},
{
"name": "image_links_first",
"type": "category"
},
{
"name": "rp_user_id",
"type": "float64"
},
{
"name": "rp_user_name",
"type": "category"
},
{
"name": "location",
"type": "category"
},
{
"name": "tweet_link",
"type": "category"
},
{
"name": "search",
"type": "category"
}
]
}
# Description of dataframe columns.
df_descrption = {
"count":{
"id":7244.0,
"author_id":7244.0,
"retweets":7244.0,
"favorites":7244.0,
"rp_user_id":4094.0
},
"mean":{
"id":1.129999764e+18,
"author_id":1.456169002e+17,
"retweets":0.1715902816,
"favorites":0.6188569851,
"rp_user_id":270815203.0
},
"std":{
"id":2.920544101e+16,
"author_id":3.490773128e+17,
"retweets":0.7395750951,
"favorites":1.8434020668,
"rp_user_id":0.0
},
"min":{
"id":1.079908205e+18,
"author_id":7007.0,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"25%":{
"id":1.10505894e+18,
"author_id":140041809.75,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"50%":{
"id":1.124196559e+18,
"author_id":318183125.5,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"75%":{
"id":1.158378457e+18,
"author_id":1901654083.0,
"retweets":0.0,
"favorites":1.0,
"rp_user_id":270815203.0
},
"max":{
"id":1.176868218e+18,
"author_id":1.175435395e+18,
"retweets":17.0,
"favorites":41.0,
"rp_user_id":270815203.0
}
}
# Randome sample of 10 rows from the dataframe.
df_random_sample = {
"count":{
"id":7244.0,
"author_id":7244.0,
"retweets":7244.0,
"favorites":7244.0,
"rp_user_id":4094.0
},
"mean":{
"id":1.129999764e+18,
"author_id":1.456169002e+17,
"retweets":0.1715902816,
"favorites":0.6188569851,
"rp_user_id":270815203.0
},
"std":{
"id":2.920544101e+16,
"author_id":3.490773128e+17,
"retweets":0.7395750951,
"favorites":1.8434020668,
"rp_user_id":0.0
},
"min":{
"id":1.079908205e+18,
"author_id":7007.0,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"25%":{
"id":1.10505894e+18,
"author_id":140041809.75,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"50%":{
"id":1.124196559e+18,
"author_id":318183125.5,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"75%":{
"id":1.158378457e+18,
"author_id":1901654083.0,
"retweets":0.0,
"favorites":1.0,
"rp_user_id":270815203.0
},
"max":{
"id":1.176868218e+18,
"author_id":1.175435395e+18,
"retweets":17.0,
"favorites":41.0,
"rp_user_id":270815203.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 an author who received no retweets for any of their posts?
# 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 an author who received no retweets for any of their posts?
df.columns = ['id', 'author_id', 'author_name', 'author_handler', 'author_avatar', 'lang', 'type', 'text', 'date', 'mention_ids', 'mention_names', 'retweets', 'favorites', 'links', 'links_first', 'image_links', 'image_links_first', 'rp_user_id', 'rp_user_name', 'location', 'tweet_link', 'search']
# Expected output type: is boolean, this will be checked.
return | 20250129013714 |
3 | Are there any posts that do not contain any links? | 050_ING | dev | boolean | ['links'] | 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": "int64"
},
{
"name": "author_name",
"type": "category"
},
{
"name": "author_handler",
"type": "category"
},
{
"name": "author_avatar",
"type": "category"
},
{
"name": "lang",
"type": "category"
},
{
"name": "type",
"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": "uint8"
},
{
"name": "favorites",
"type": "uint8"
},
{
"name": "links",
"type": "object"
},
{
"name": "links_first",
"type": "category"
},
{
"name": "image_links",
"type": "object"
},
{
"name": "image_links_first",
"type": "category"
},
{
"name": "rp_user_id",
"type": "float64"
},
{
"name": "rp_user_name",
"type": "category"
},
{
"name": "location",
"type": "category"
},
{
"name": "tweet_link",
"type": "category"
},
{
"name": "search",
"type": "category"
}
]
}
# Description of dataframe columns.
df_descrption = {
"count":{
"id":7244.0,
"author_id":7244.0,
"retweets":7244.0,
"favorites":7244.0,
"rp_user_id":4094.0
},
"mean":{
"id":1.129999764e+18,
"author_id":1.456169002e+17,
"retweets":0.1715902816,
"favorites":0.6188569851,
"rp_user_id":270815203.0
},
"std":{
"id":2.920544101e+16,
"author_id":3.490773128e+17,
"retweets":0.7395750951,
"favorites":1.8434020668,
"rp_user_id":0.0
},
"min":{
"id":1.079908205e+18,
"author_id":7007.0,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"25%":{
"id":1.10505894e+18,
"author_id":140041809.75,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"50%":{
"id":1.124196559e+18,
"author_id":318183125.5,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"75%":{
"id":1.158378457e+18,
"author_id":1901654083.0,
"retweets":0.0,
"favorites":1.0,
"rp_user_id":270815203.0
},
"max":{
"id":1.176868218e+18,
"author_id":1.175435395e+18,
"retweets":17.0,
"favorites":41.0,
"rp_user_id":270815203.0
}
}
# Randome sample of 10 rows from the dataframe.
df_random_sample = {
"count":{
"id":7244.0,
"author_id":7244.0,
"retweets":7244.0,
"favorites":7244.0,
"rp_user_id":4094.0
},
"mean":{
"id":1.129999764e+18,
"author_id":1.456169002e+17,
"retweets":0.1715902816,
"favorites":0.6188569851,
"rp_user_id":270815203.0
},
"std":{
"id":2.920544101e+16,
"author_id":3.490773128e+17,
"retweets":0.7395750951,
"favorites":1.8434020668,
"rp_user_id":0.0
},
"min":{
"id":1.079908205e+18,
"author_id":7007.0,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"25%":{
"id":1.10505894e+18,
"author_id":140041809.75,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"50%":{
"id":1.124196559e+18,
"author_id":318183125.5,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"75%":{
"id":1.158378457e+18,
"author_id":1901654083.0,
"retweets":0.0,
"favorites":1.0,
"rp_user_id":270815203.0
},
"max":{
"id":1.176868218e+18,
"author_id":1.175435395e+18,
"retweets":17.0,
"favorites":41.0,
"rp_user_id":270815203.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 posts that do not contain any links?
# 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 posts that do not contain any links?
df.columns = ['id', 'author_id', 'author_name', 'author_handler', 'author_avatar', 'lang', 'type', 'text', 'date', 'mention_ids', 'mention_names', 'retweets', 'favorites', 'links', 'links_first', 'image_links', 'image_links_first', 'rp_user_id', 'rp_user_name', 'location', 'tweet_link', 'search']
# Expected output type: is boolean, this will be checked.
return | 20250129013714 |
4 | How many unique authors are in the dataset? | 050_ING | 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": "int64"
},
{
"name": "author_name",
"type": "category"
},
{
"name": "author_handler",
"type": "category"
},
{
"name": "author_avatar",
"type": "category"
},
{
"name": "lang",
"type": "category"
},
{
"name": "type",
"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": "uint8"
},
{
"name": "favorites",
"type": "uint8"
},
{
"name": "links",
"type": "object"
},
{
"name": "links_first",
"type": "category"
},
{
"name": "image_links",
"type": "object"
},
{
"name": "image_links_first",
"type": "category"
},
{
"name": "rp_user_id",
"type": "float64"
},
{
"name": "rp_user_name",
"type": "category"
},
{
"name": "location",
"type": "category"
},
{
"name": "tweet_link",
"type": "category"
},
{
"name": "search",
"type": "category"
}
]
}
# Description of dataframe columns.
df_descrption = {
"count":{
"id":7244.0,
"author_id":7244.0,
"retweets":7244.0,
"favorites":7244.0,
"rp_user_id":4094.0
},
"mean":{
"id":1.129999764e+18,
"author_id":1.456169002e+17,
"retweets":0.1715902816,
"favorites":0.6188569851,
"rp_user_id":270815203.0
},
"std":{
"id":2.920544101e+16,
"author_id":3.490773128e+17,
"retweets":0.7395750951,
"favorites":1.8434020668,
"rp_user_id":0.0
},
"min":{
"id":1.079908205e+18,
"author_id":7007.0,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"25%":{
"id":1.10505894e+18,
"author_id":140041809.75,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"50%":{
"id":1.124196559e+18,
"author_id":318183125.5,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"75%":{
"id":1.158378457e+18,
"author_id":1901654083.0,
"retweets":0.0,
"favorites":1.0,
"rp_user_id":270815203.0
},
"max":{
"id":1.176868218e+18,
"author_id":1.175435395e+18,
"retweets":17.0,
"favorites":41.0,
"rp_user_id":270815203.0
}
}
# Randome sample of 10 rows from the dataframe.
df_random_sample = {
"count":{
"id":7244.0,
"author_id":7244.0,
"retweets":7244.0,
"favorites":7244.0,
"rp_user_id":4094.0
},
"mean":{
"id":1.129999764e+18,
"author_id":1.456169002e+17,
"retweets":0.1715902816,
"favorites":0.6188569851,
"rp_user_id":270815203.0
},
"std":{
"id":2.920544101e+16,
"author_id":3.490773128e+17,
"retweets":0.7395750951,
"favorites":1.8434020668,
"rp_user_id":0.0
},
"min":{
"id":1.079908205e+18,
"author_id":7007.0,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"25%":{
"id":1.10505894e+18,
"author_id":140041809.75,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"50%":{
"id":1.124196559e+18,
"author_id":318183125.5,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"75%":{
"id":1.158378457e+18,
"author_id":1901654083.0,
"retweets":0.0,
"favorites":1.0,
"rp_user_id":270815203.0
},
"max":{
"id":1.176868218e+18,
"author_id":1.175435395e+18,
"retweets":17.0,
"favorites":41.0,
"rp_user_id":270815203.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 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 authors are in the dataset?
df.columns = ['id', 'author_id', 'author_name', 'author_handler', 'author_avatar', 'lang', 'type', 'text', 'date', 'mention_ids', 'mention_names', 'retweets', 'favorites', 'links', 'links_first', 'image_links', 'image_links_first', 'rp_user_id', 'rp_user_name', 'location', 'tweet_link', 'search']
# Expected output type: is number, this will be checked.
return | 20250129013714 |
5 | What is the length of the longest post (based on the number of words)? | 050_ING | dev | number | ['text'] | 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": "int64"
},
{
"name": "author_name",
"type": "category"
},
{
"name": "author_handler",
"type": "category"
},
{
"name": "author_avatar",
"type": "category"
},
{
"name": "lang",
"type": "category"
},
{
"name": "type",
"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": "uint8"
},
{
"name": "favorites",
"type": "uint8"
},
{
"name": "links",
"type": "object"
},
{
"name": "links_first",
"type": "category"
},
{
"name": "image_links",
"type": "object"
},
{
"name": "image_links_first",
"type": "category"
},
{
"name": "rp_user_id",
"type": "float64"
},
{
"name": "rp_user_name",
"type": "category"
},
{
"name": "location",
"type": "category"
},
{
"name": "tweet_link",
"type": "category"
},
{
"name": "search",
"type": "category"
}
]
}
# Description of dataframe columns.
df_descrption = {
"count":{
"id":7244.0,
"author_id":7244.0,
"retweets":7244.0,
"favorites":7244.0,
"rp_user_id":4094.0
},
"mean":{
"id":1.129999764e+18,
"author_id":1.456169002e+17,
"retweets":0.1715902816,
"favorites":0.6188569851,
"rp_user_id":270815203.0
},
"std":{
"id":2.920544101e+16,
"author_id":3.490773128e+17,
"retweets":0.7395750951,
"favorites":1.8434020668,
"rp_user_id":0.0
},
"min":{
"id":1.079908205e+18,
"author_id":7007.0,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"25%":{
"id":1.10505894e+18,
"author_id":140041809.75,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"50%":{
"id":1.124196559e+18,
"author_id":318183125.5,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"75%":{
"id":1.158378457e+18,
"author_id":1901654083.0,
"retweets":0.0,
"favorites":1.0,
"rp_user_id":270815203.0
},
"max":{
"id":1.176868218e+18,
"author_id":1.175435395e+18,
"retweets":17.0,
"favorites":41.0,
"rp_user_id":270815203.0
}
}
# Randome sample of 10 rows from the dataframe.
df_random_sample = {
"count":{
"id":7244.0,
"author_id":7244.0,
"retweets":7244.0,
"favorites":7244.0,
"rp_user_id":4094.0
},
"mean":{
"id":1.129999764e+18,
"author_id":1.456169002e+17,
"retweets":0.1715902816,
"favorites":0.6188569851,
"rp_user_id":270815203.0
},
"std":{
"id":2.920544101e+16,
"author_id":3.490773128e+17,
"retweets":0.7395750951,
"favorites":1.8434020668,
"rp_user_id":0.0
},
"min":{
"id":1.079908205e+18,
"author_id":7007.0,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"25%":{
"id":1.10505894e+18,
"author_id":140041809.75,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"50%":{
"id":1.124196559e+18,
"author_id":318183125.5,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"75%":{
"id":1.158378457e+18,
"author_id":1901654083.0,
"retweets":0.0,
"favorites":1.0,
"rp_user_id":270815203.0
},
"max":{
"id":1.176868218e+18,
"author_id":1.175435395e+18,
"retweets":17.0,
"favorites":41.0,
"rp_user_id":270815203.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 length of the longest post (based on the number of words)?
# 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 length of the longest post (based on the number of words)?
df.columns = ['id', 'author_id', 'author_name', 'author_handler', 'author_avatar', 'lang', 'type', 'text', 'date', 'mention_ids', 'mention_names', 'retweets', 'favorites', 'links', 'links_first', 'image_links', 'image_links_first', 'rp_user_id', 'rp_user_name', 'location', 'tweet_link', 'search']
# Expected output type: is number, this will be checked.
return | 20250129013714 |
6 | What is the total number of retweets received by all authors in the dataset? | 050_ING | 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": "int64"
},
{
"name": "author_name",
"type": "category"
},
{
"name": "author_handler",
"type": "category"
},
{
"name": "author_avatar",
"type": "category"
},
{
"name": "lang",
"type": "category"
},
{
"name": "type",
"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": "uint8"
},
{
"name": "favorites",
"type": "uint8"
},
{
"name": "links",
"type": "object"
},
{
"name": "links_first",
"type": "category"
},
{
"name": "image_links",
"type": "object"
},
{
"name": "image_links_first",
"type": "category"
},
{
"name": "rp_user_id",
"type": "float64"
},
{
"name": "rp_user_name",
"type": "category"
},
{
"name": "location",
"type": "category"
},
{
"name": "tweet_link",
"type": "category"
},
{
"name": "search",
"type": "category"
}
]
}
# Description of dataframe columns.
df_descrption = {
"count":{
"id":7244.0,
"author_id":7244.0,
"retweets":7244.0,
"favorites":7244.0,
"rp_user_id":4094.0
},
"mean":{
"id":1.129999764e+18,
"author_id":1.456169002e+17,
"retweets":0.1715902816,
"favorites":0.6188569851,
"rp_user_id":270815203.0
},
"std":{
"id":2.920544101e+16,
"author_id":3.490773128e+17,
"retweets":0.7395750951,
"favorites":1.8434020668,
"rp_user_id":0.0
},
"min":{
"id":1.079908205e+18,
"author_id":7007.0,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"25%":{
"id":1.10505894e+18,
"author_id":140041809.75,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"50%":{
"id":1.124196559e+18,
"author_id":318183125.5,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"75%":{
"id":1.158378457e+18,
"author_id":1901654083.0,
"retweets":0.0,
"favorites":1.0,
"rp_user_id":270815203.0
},
"max":{
"id":1.176868218e+18,
"author_id":1.175435395e+18,
"retweets":17.0,
"favorites":41.0,
"rp_user_id":270815203.0
}
}
# Randome sample of 10 rows from the dataframe.
df_random_sample = {
"count":{
"id":7244.0,
"author_id":7244.0,
"retweets":7244.0,
"favorites":7244.0,
"rp_user_id":4094.0
},
"mean":{
"id":1.129999764e+18,
"author_id":1.456169002e+17,
"retweets":0.1715902816,
"favorites":0.6188569851,
"rp_user_id":270815203.0
},
"std":{
"id":2.920544101e+16,
"author_id":3.490773128e+17,
"retweets":0.7395750951,
"favorites":1.8434020668,
"rp_user_id":0.0
},
"min":{
"id":1.079908205e+18,
"author_id":7007.0,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"25%":{
"id":1.10505894e+18,
"author_id":140041809.75,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"50%":{
"id":1.124196559e+18,
"author_id":318183125.5,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"75%":{
"id":1.158378457e+18,
"author_id":1901654083.0,
"retweets":0.0,
"favorites":1.0,
"rp_user_id":270815203.0
},
"max":{
"id":1.176868218e+18,
"author_id":1.175435395e+18,
"retweets":17.0,
"favorites":41.0,
"rp_user_id":270815203.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 total number of retweets received by all authors 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: What is the total number of retweets received by all authors in the dataset?
df.columns = ['id', 'author_id', 'author_name', 'author_handler', 'author_avatar', 'lang', 'type', 'text', 'date', 'mention_ids', 'mention_names', 'retweets', 'favorites', 'links', 'links_first', 'image_links', 'image_links_first', 'rp_user_id', 'rp_user_name', 'location', 'tweet_link', 'search']
# Expected output type: is number, this will be checked.
return | 20250129013714 |
7 | How many posts do not contain any mentions of other users? | 050_ING | dev | number | ['mention_ids'] | 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": "int64"
},
{
"name": "author_name",
"type": "category"
},
{
"name": "author_handler",
"type": "category"
},
{
"name": "author_avatar",
"type": "category"
},
{
"name": "lang",
"type": "category"
},
{
"name": "type",
"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": "uint8"
},
{
"name": "favorites",
"type": "uint8"
},
{
"name": "links",
"type": "object"
},
{
"name": "links_first",
"type": "category"
},
{
"name": "image_links",
"type": "object"
},
{
"name": "image_links_first",
"type": "category"
},
{
"name": "rp_user_id",
"type": "float64"
},
{
"name": "rp_user_name",
"type": "category"
},
{
"name": "location",
"type": "category"
},
{
"name": "tweet_link",
"type": "category"
},
{
"name": "search",
"type": "category"
}
]
}
# Description of dataframe columns.
df_descrption = {
"count":{
"id":7244.0,
"author_id":7244.0,
"retweets":7244.0,
"favorites":7244.0,
"rp_user_id":4094.0
},
"mean":{
"id":1.129999764e+18,
"author_id":1.456169002e+17,
"retweets":0.1715902816,
"favorites":0.6188569851,
"rp_user_id":270815203.0
},
"std":{
"id":2.920544101e+16,
"author_id":3.490773128e+17,
"retweets":0.7395750951,
"favorites":1.8434020668,
"rp_user_id":0.0
},
"min":{
"id":1.079908205e+18,
"author_id":7007.0,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"25%":{
"id":1.10505894e+18,
"author_id":140041809.75,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"50%":{
"id":1.124196559e+18,
"author_id":318183125.5,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"75%":{
"id":1.158378457e+18,
"author_id":1901654083.0,
"retweets":0.0,
"favorites":1.0,
"rp_user_id":270815203.0
},
"max":{
"id":1.176868218e+18,
"author_id":1.175435395e+18,
"retweets":17.0,
"favorites":41.0,
"rp_user_id":270815203.0
}
}
# Randome sample of 10 rows from the dataframe.
df_random_sample = {
"count":{
"id":7244.0,
"author_id":7244.0,
"retweets":7244.0,
"favorites":7244.0,
"rp_user_id":4094.0
},
"mean":{
"id":1.129999764e+18,
"author_id":1.456169002e+17,
"retweets":0.1715902816,
"favorites":0.6188569851,
"rp_user_id":270815203.0
},
"std":{
"id":2.920544101e+16,
"author_id":3.490773128e+17,
"retweets":0.7395750951,
"favorites":1.8434020668,
"rp_user_id":0.0
},
"min":{
"id":1.079908205e+18,
"author_id":7007.0,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"25%":{
"id":1.10505894e+18,
"author_id":140041809.75,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"50%":{
"id":1.124196559e+18,
"author_id":318183125.5,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"75%":{
"id":1.158378457e+18,
"author_id":1901654083.0,
"retweets":0.0,
"favorites":1.0,
"rp_user_id":270815203.0
},
"max":{
"id":1.176868218e+18,
"author_id":1.175435395e+18,
"retweets":17.0,
"favorites":41.0,
"rp_user_id":270815203.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 posts do not contain any mentions of other users?
# 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 posts do not contain any mentions of other users?
df.columns = ['id', 'author_id', 'author_name', 'author_handler', 'author_avatar', 'lang', 'type', 'text', 'date', 'mention_ids', 'mention_names', 'retweets', 'favorites', 'links', 'links_first', 'image_links', 'image_links_first', 'rp_user_id', 'rp_user_name', 'location', 'tweet_link', 'search']
# Expected output type: is number, this will be checked.
return | 20250129013714 |
8 | What is the name of the author with the most retweeted single tweet? | 050_ING | dev | category | ['author_name', '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": "int64"
},
{
"name": "author_name",
"type": "category"
},
{
"name": "author_handler",
"type": "category"
},
{
"name": "author_avatar",
"type": "category"
},
{
"name": "lang",
"type": "category"
},
{
"name": "type",
"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": "uint8"
},
{
"name": "favorites",
"type": "uint8"
},
{
"name": "links",
"type": "object"
},
{
"name": "links_first",
"type": "category"
},
{
"name": "image_links",
"type": "object"
},
{
"name": "image_links_first",
"type": "category"
},
{
"name": "rp_user_id",
"type": "float64"
},
{
"name": "rp_user_name",
"type": "category"
},
{
"name": "location",
"type": "category"
},
{
"name": "tweet_link",
"type": "category"
},
{
"name": "search",
"type": "category"
}
]
}
# Description of dataframe columns.
df_descrption = {
"count":{
"id":7244.0,
"author_id":7244.0,
"retweets":7244.0,
"favorites":7244.0,
"rp_user_id":4094.0
},
"mean":{
"id":1.129999764e+18,
"author_id":1.456169002e+17,
"retweets":0.1715902816,
"favorites":0.6188569851,
"rp_user_id":270815203.0
},
"std":{
"id":2.920544101e+16,
"author_id":3.490773128e+17,
"retweets":0.7395750951,
"favorites":1.8434020668,
"rp_user_id":0.0
},
"min":{
"id":1.079908205e+18,
"author_id":7007.0,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"25%":{
"id":1.10505894e+18,
"author_id":140041809.75,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"50%":{
"id":1.124196559e+18,
"author_id":318183125.5,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"75%":{
"id":1.158378457e+18,
"author_id":1901654083.0,
"retweets":0.0,
"favorites":1.0,
"rp_user_id":270815203.0
},
"max":{
"id":1.176868218e+18,
"author_id":1.175435395e+18,
"retweets":17.0,
"favorites":41.0,
"rp_user_id":270815203.0
}
}
# Randome sample of 10 rows from the dataframe.
df_random_sample = {
"count":{
"id":7244.0,
"author_id":7244.0,
"retweets":7244.0,
"favorites":7244.0,
"rp_user_id":4094.0
},
"mean":{
"id":1.129999764e+18,
"author_id":1.456169002e+17,
"retweets":0.1715902816,
"favorites":0.6188569851,
"rp_user_id":270815203.0
},
"std":{
"id":2.920544101e+16,
"author_id":3.490773128e+17,
"retweets":0.7395750951,
"favorites":1.8434020668,
"rp_user_id":0.0
},
"min":{
"id":1.079908205e+18,
"author_id":7007.0,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"25%":{
"id":1.10505894e+18,
"author_id":140041809.75,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"50%":{
"id":1.124196559e+18,
"author_id":318183125.5,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"75%":{
"id":1.158378457e+18,
"author_id":1901654083.0,
"retweets":0.0,
"favorites":1.0,
"rp_user_id":270815203.0
},
"max":{
"id":1.176868218e+18,
"author_id":1.175435395e+18,
"retweets":17.0,
"favorites":41.0,
"rp_user_id":270815203.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 author with the most retweeted 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 name of the author with the most retweeted single tweet?
df.columns = ['id', 'author_id', 'author_name', 'author_handler', 'author_avatar', 'lang', 'type', 'text', 'date', 'mention_ids', 'mention_names', 'retweets', 'favorites', 'links', 'links_first', 'image_links', 'image_links_first', 'rp_user_id', 'rp_user_name', 'location', 'tweet_link', 'search']
# Expected output type: is category, this will be checked.
return | 20250129013714 |
9 | What is the language of the most favorited post? | 050_ING | dev | category | ['lang', '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": "int64"
},
{
"name": "author_name",
"type": "category"
},
{
"name": "author_handler",
"type": "category"
},
{
"name": "author_avatar",
"type": "category"
},
{
"name": "lang",
"type": "category"
},
{
"name": "type",
"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": "uint8"
},
{
"name": "favorites",
"type": "uint8"
},
{
"name": "links",
"type": "object"
},
{
"name": "links_first",
"type": "category"
},
{
"name": "image_links",
"type": "object"
},
{
"name": "image_links_first",
"type": "category"
},
{
"name": "rp_user_id",
"type": "float64"
},
{
"name": "rp_user_name",
"type": "category"
},
{
"name": "location",
"type": "category"
},
{
"name": "tweet_link",
"type": "category"
},
{
"name": "search",
"type": "category"
}
]
}
# Description of dataframe columns.
df_descrption = {
"count":{
"id":7244.0,
"author_id":7244.0,
"retweets":7244.0,
"favorites":7244.0,
"rp_user_id":4094.0
},
"mean":{
"id":1.129999764e+18,
"author_id":1.456169002e+17,
"retweets":0.1715902816,
"favorites":0.6188569851,
"rp_user_id":270815203.0
},
"std":{
"id":2.920544101e+16,
"author_id":3.490773128e+17,
"retweets":0.7395750951,
"favorites":1.8434020668,
"rp_user_id":0.0
},
"min":{
"id":1.079908205e+18,
"author_id":7007.0,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"25%":{
"id":1.10505894e+18,
"author_id":140041809.75,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"50%":{
"id":1.124196559e+18,
"author_id":318183125.5,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"75%":{
"id":1.158378457e+18,
"author_id":1901654083.0,
"retweets":0.0,
"favorites":1.0,
"rp_user_id":270815203.0
},
"max":{
"id":1.176868218e+18,
"author_id":1.175435395e+18,
"retweets":17.0,
"favorites":41.0,
"rp_user_id":270815203.0
}
}
# Randome sample of 10 rows from the dataframe.
df_random_sample = {
"count":{
"id":7244.0,
"author_id":7244.0,
"retweets":7244.0,
"favorites":7244.0,
"rp_user_id":4094.0
},
"mean":{
"id":1.129999764e+18,
"author_id":1.456169002e+17,
"retweets":0.1715902816,
"favorites":0.6188569851,
"rp_user_id":270815203.0
},
"std":{
"id":2.920544101e+16,
"author_id":3.490773128e+17,
"retweets":0.7395750951,
"favorites":1.8434020668,
"rp_user_id":0.0
},
"min":{
"id":1.079908205e+18,
"author_id":7007.0,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"25%":{
"id":1.10505894e+18,
"author_id":140041809.75,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"50%":{
"id":1.124196559e+18,
"author_id":318183125.5,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"75%":{
"id":1.158378457e+18,
"author_id":1901654083.0,
"retweets":0.0,
"favorites":1.0,
"rp_user_id":270815203.0
},
"max":{
"id":1.176868218e+18,
"author_id":1.175435395e+18,
"retweets":17.0,
"favorites":41.0,
"rp_user_id":270815203.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 language of the most favorited post?
# 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 language of the most favorited post?
df.columns = ['id', 'author_id', 'author_name', 'author_handler', 'author_avatar', 'lang', 'type', 'text', 'date', 'mention_ids', 'mention_names', 'retweets', 'favorites', 'links', 'links_first', 'image_links', 'image_links_first', 'rp_user_id', 'rp_user_name', 'location', 'tweet_link', 'search']
# Expected output type: is category, this will be checked.
return | 20250129013714 |
10 | Who is the author of the post with the most words? | 050_ING | dev | category | ['author_name', 'text'] | 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": "int64"
},
{
"name": "author_name",
"type": "category"
},
{
"name": "author_handler",
"type": "category"
},
{
"name": "author_avatar",
"type": "category"
},
{
"name": "lang",
"type": "category"
},
{
"name": "type",
"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": "uint8"
},
{
"name": "favorites",
"type": "uint8"
},
{
"name": "links",
"type": "object"
},
{
"name": "links_first",
"type": "category"
},
{
"name": "image_links",
"type": "object"
},
{
"name": "image_links_first",
"type": "category"
},
{
"name": "rp_user_id",
"type": "float64"
},
{
"name": "rp_user_name",
"type": "category"
},
{
"name": "location",
"type": "category"
},
{
"name": "tweet_link",
"type": "category"
},
{
"name": "search",
"type": "category"
}
]
}
# Description of dataframe columns.
df_descrption = {
"count":{
"id":7244.0,
"author_id":7244.0,
"retweets":7244.0,
"favorites":7244.0,
"rp_user_id":4094.0
},
"mean":{
"id":1.129999764e+18,
"author_id":1.456169002e+17,
"retweets":0.1715902816,
"favorites":0.6188569851,
"rp_user_id":270815203.0
},
"std":{
"id":2.920544101e+16,
"author_id":3.490773128e+17,
"retweets":0.7395750951,
"favorites":1.8434020668,
"rp_user_id":0.0
},
"min":{
"id":1.079908205e+18,
"author_id":7007.0,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"25%":{
"id":1.10505894e+18,
"author_id":140041809.75,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"50%":{
"id":1.124196559e+18,
"author_id":318183125.5,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"75%":{
"id":1.158378457e+18,
"author_id":1901654083.0,
"retweets":0.0,
"favorites":1.0,
"rp_user_id":270815203.0
},
"max":{
"id":1.176868218e+18,
"author_id":1.175435395e+18,
"retweets":17.0,
"favorites":41.0,
"rp_user_id":270815203.0
}
}
# Randome sample of 10 rows from the dataframe.
df_random_sample = {
"count":{
"id":7244.0,
"author_id":7244.0,
"retweets":7244.0,
"favorites":7244.0,
"rp_user_id":4094.0
},
"mean":{
"id":1.129999764e+18,
"author_id":1.456169002e+17,
"retweets":0.1715902816,
"favorites":0.6188569851,
"rp_user_id":270815203.0
},
"std":{
"id":2.920544101e+16,
"author_id":3.490773128e+17,
"retweets":0.7395750951,
"favorites":1.8434020668,
"rp_user_id":0.0
},
"min":{
"id":1.079908205e+18,
"author_id":7007.0,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"25%":{
"id":1.10505894e+18,
"author_id":140041809.75,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"50%":{
"id":1.124196559e+18,
"author_id":318183125.5,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"75%":{
"id":1.158378457e+18,
"author_id":1901654083.0,
"retweets":0.0,
"favorites":1.0,
"rp_user_id":270815203.0
},
"max":{
"id":1.176868218e+18,
"author_id":1.175435395e+18,
"retweets":17.0,
"favorites":41.0,
"rp_user_id":270815203.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: Who is the author of the post with the most words?
# The answer should only contain python code, you are not allowed leave any TODO undone.
def answer(df: pd.DataFrame):
# Use df to answer: Who is the author of the post with the most words?
df.columns = ['id', 'author_id', 'author_name', 'author_handler', 'author_avatar', 'lang', 'type', 'text', 'date', 'mention_ids', 'mention_names', 'retweets', 'favorites', 'links', 'links_first', 'image_links', 'image_links_first', 'rp_user_id', 'rp_user_name', 'location', 'tweet_link', 'search']
# Expected output type: is category, this will be checked.
return | 20250129013714 |
11 | What type of post (original, reply, or other) is the most common in the dataset? | 050_ING | dev | category | ['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": "id",
"type": "int64"
},
{
"name": "author_id",
"type": "int64"
},
{
"name": "author_name",
"type": "category"
},
{
"name": "author_handler",
"type": "category"
},
{
"name": "author_avatar",
"type": "category"
},
{
"name": "lang",
"type": "category"
},
{
"name": "type",
"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": "uint8"
},
{
"name": "favorites",
"type": "uint8"
},
{
"name": "links",
"type": "object"
},
{
"name": "links_first",
"type": "category"
},
{
"name": "image_links",
"type": "object"
},
{
"name": "image_links_first",
"type": "category"
},
{
"name": "rp_user_id",
"type": "float64"
},
{
"name": "rp_user_name",
"type": "category"
},
{
"name": "location",
"type": "category"
},
{
"name": "tweet_link",
"type": "category"
},
{
"name": "search",
"type": "category"
}
]
}
# Description of dataframe columns.
df_descrption = {
"count":{
"id":7244.0,
"author_id":7244.0,
"retweets":7244.0,
"favorites":7244.0,
"rp_user_id":4094.0
},
"mean":{
"id":1.129999764e+18,
"author_id":1.456169002e+17,
"retweets":0.1715902816,
"favorites":0.6188569851,
"rp_user_id":270815203.0
},
"std":{
"id":2.920544101e+16,
"author_id":3.490773128e+17,
"retweets":0.7395750951,
"favorites":1.8434020668,
"rp_user_id":0.0
},
"min":{
"id":1.079908205e+18,
"author_id":7007.0,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"25%":{
"id":1.10505894e+18,
"author_id":140041809.75,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"50%":{
"id":1.124196559e+18,
"author_id":318183125.5,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"75%":{
"id":1.158378457e+18,
"author_id":1901654083.0,
"retweets":0.0,
"favorites":1.0,
"rp_user_id":270815203.0
},
"max":{
"id":1.176868218e+18,
"author_id":1.175435395e+18,
"retweets":17.0,
"favorites":41.0,
"rp_user_id":270815203.0
}
}
# Randome sample of 10 rows from the dataframe.
df_random_sample = {
"count":{
"id":7244.0,
"author_id":7244.0,
"retweets":7244.0,
"favorites":7244.0,
"rp_user_id":4094.0
},
"mean":{
"id":1.129999764e+18,
"author_id":1.456169002e+17,
"retweets":0.1715902816,
"favorites":0.6188569851,
"rp_user_id":270815203.0
},
"std":{
"id":2.920544101e+16,
"author_id":3.490773128e+17,
"retweets":0.7395750951,
"favorites":1.8434020668,
"rp_user_id":0.0
},
"min":{
"id":1.079908205e+18,
"author_id":7007.0,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"25%":{
"id":1.10505894e+18,
"author_id":140041809.75,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"50%":{
"id":1.124196559e+18,
"author_id":318183125.5,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"75%":{
"id":1.158378457e+18,
"author_id":1901654083.0,
"retweets":0.0,
"favorites":1.0,
"rp_user_id":270815203.0
},
"max":{
"id":1.176868218e+18,
"author_id":1.175435395e+18,
"retweets":17.0,
"favorites":41.0,
"rp_user_id":270815203.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 type of post (original, reply, or other) is the most common 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: What type of post (original, reply, or other) is the most common in the dataset?
df.columns = ['id', 'author_id', 'author_name', 'author_handler', 'author_avatar', 'lang', 'type', 'text', 'date', 'mention_ids', 'mention_names', 'retweets', 'favorites', 'links', 'links_first', 'image_links', 'image_links_first', 'rp_user_id', 'rp_user_name', 'location', 'tweet_link', 'search']
# Expected output type: is category, this will be checked.
return | 20250129013714 |
12 | Who are the authors of the top 3 most retweeted posts? | 050_ING | dev | list[category] | ['author_name', '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": "int64"
},
{
"name": "author_name",
"type": "category"
},
{
"name": "author_handler",
"type": "category"
},
{
"name": "author_avatar",
"type": "category"
},
{
"name": "lang",
"type": "category"
},
{
"name": "type",
"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": "uint8"
},
{
"name": "favorites",
"type": "uint8"
},
{
"name": "links",
"type": "object"
},
{
"name": "links_first",
"type": "category"
},
{
"name": "image_links",
"type": "object"
},
{
"name": "image_links_first",
"type": "category"
},
{
"name": "rp_user_id",
"type": "float64"
},
{
"name": "rp_user_name",
"type": "category"
},
{
"name": "location",
"type": "category"
},
{
"name": "tweet_link",
"type": "category"
},
{
"name": "search",
"type": "category"
}
]
}
# Description of dataframe columns.
df_descrption = {
"count":{
"id":7244.0,
"author_id":7244.0,
"retweets":7244.0,
"favorites":7244.0,
"rp_user_id":4094.0
},
"mean":{
"id":1.129999764e+18,
"author_id":1.456169002e+17,
"retweets":0.1715902816,
"favorites":0.6188569851,
"rp_user_id":270815203.0
},
"std":{
"id":2.920544101e+16,
"author_id":3.490773128e+17,
"retweets":0.7395750951,
"favorites":1.8434020668,
"rp_user_id":0.0
},
"min":{
"id":1.079908205e+18,
"author_id":7007.0,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"25%":{
"id":1.10505894e+18,
"author_id":140041809.75,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"50%":{
"id":1.124196559e+18,
"author_id":318183125.5,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"75%":{
"id":1.158378457e+18,
"author_id":1901654083.0,
"retweets":0.0,
"favorites":1.0,
"rp_user_id":270815203.0
},
"max":{
"id":1.176868218e+18,
"author_id":1.175435395e+18,
"retweets":17.0,
"favorites":41.0,
"rp_user_id":270815203.0
}
}
# Randome sample of 10 rows from the dataframe.
df_random_sample = {
"count":{
"id":7244.0,
"author_id":7244.0,
"retweets":7244.0,
"favorites":7244.0,
"rp_user_id":4094.0
},
"mean":{
"id":1.129999764e+18,
"author_id":1.456169002e+17,
"retweets":0.1715902816,
"favorites":0.6188569851,
"rp_user_id":270815203.0
},
"std":{
"id":2.920544101e+16,
"author_id":3.490773128e+17,
"retweets":0.7395750951,
"favorites":1.8434020668,
"rp_user_id":0.0
},
"min":{
"id":1.079908205e+18,
"author_id":7007.0,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"25%":{
"id":1.10505894e+18,
"author_id":140041809.75,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"50%":{
"id":1.124196559e+18,
"author_id":318183125.5,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"75%":{
"id":1.158378457e+18,
"author_id":1901654083.0,
"retweets":0.0,
"favorites":1.0,
"rp_user_id":270815203.0
},
"max":{
"id":1.176868218e+18,
"author_id":1.175435395e+18,
"retweets":17.0,
"favorites":41.0,
"rp_user_id":270815203.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: Who are the authors of the top 3 most retweeted posts?
# The answer should only contain python code, you are not allowed leave any TODO undone.
def answer(df: pd.DataFrame):
# Use df to answer: Who are the authors of the top 3 most retweeted posts?
df.columns = ['id', 'author_id', 'author_name', 'author_handler', 'author_avatar', 'lang', 'type', 'text', 'date', 'mention_ids', 'mention_names', 'retweets', 'favorites', 'links', 'links_first', 'image_links', 'image_links_first', 'rp_user_id', 'rp_user_name', 'location', 'tweet_link', 'search']
# Expected output type: is list[category], this will be checked.
return | 20250129013714 |
13 | What are the languages of the 5 least favorited posts? | 050_ING | dev | list[category] | ['lang', '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": "int64"
},
{
"name": "author_name",
"type": "category"
},
{
"name": "author_handler",
"type": "category"
},
{
"name": "author_avatar",
"type": "category"
},
{
"name": "lang",
"type": "category"
},
{
"name": "type",
"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": "uint8"
},
{
"name": "favorites",
"type": "uint8"
},
{
"name": "links",
"type": "object"
},
{
"name": "links_first",
"type": "category"
},
{
"name": "image_links",
"type": "object"
},
{
"name": "image_links_first",
"type": "category"
},
{
"name": "rp_user_id",
"type": "float64"
},
{
"name": "rp_user_name",
"type": "category"
},
{
"name": "location",
"type": "category"
},
{
"name": "tweet_link",
"type": "category"
},
{
"name": "search",
"type": "category"
}
]
}
# Description of dataframe columns.
df_descrption = {
"count":{
"id":7244.0,
"author_id":7244.0,
"retweets":7244.0,
"favorites":7244.0,
"rp_user_id":4094.0
},
"mean":{
"id":1.129999764e+18,
"author_id":1.456169002e+17,
"retweets":0.1715902816,
"favorites":0.6188569851,
"rp_user_id":270815203.0
},
"std":{
"id":2.920544101e+16,
"author_id":3.490773128e+17,
"retweets":0.7395750951,
"favorites":1.8434020668,
"rp_user_id":0.0
},
"min":{
"id":1.079908205e+18,
"author_id":7007.0,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"25%":{
"id":1.10505894e+18,
"author_id":140041809.75,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"50%":{
"id":1.124196559e+18,
"author_id":318183125.5,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"75%":{
"id":1.158378457e+18,
"author_id":1901654083.0,
"retweets":0.0,
"favorites":1.0,
"rp_user_id":270815203.0
},
"max":{
"id":1.176868218e+18,
"author_id":1.175435395e+18,
"retweets":17.0,
"favorites":41.0,
"rp_user_id":270815203.0
}
}
# Randome sample of 10 rows from the dataframe.
df_random_sample = {
"count":{
"id":7244.0,
"author_id":7244.0,
"retweets":7244.0,
"favorites":7244.0,
"rp_user_id":4094.0
},
"mean":{
"id":1.129999764e+18,
"author_id":1.456169002e+17,
"retweets":0.1715902816,
"favorites":0.6188569851,
"rp_user_id":270815203.0
},
"std":{
"id":2.920544101e+16,
"author_id":3.490773128e+17,
"retweets":0.7395750951,
"favorites":1.8434020668,
"rp_user_id":0.0
},
"min":{
"id":1.079908205e+18,
"author_id":7007.0,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"25%":{
"id":1.10505894e+18,
"author_id":140041809.75,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"50%":{
"id":1.124196559e+18,
"author_id":318183125.5,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"75%":{
"id":1.158378457e+18,
"author_id":1901654083.0,
"retweets":0.0,
"favorites":1.0,
"rp_user_id":270815203.0
},
"max":{
"id":1.176868218e+18,
"author_id":1.175435395e+18,
"retweets":17.0,
"favorites":41.0,
"rp_user_id":270815203.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 languages of the 5 least favorited posts?
# 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 languages of the 5 least favorited posts?
df.columns = ['id', 'author_id', 'author_name', 'author_handler', 'author_avatar', 'lang', 'type', 'text', 'date', 'mention_ids', 'mention_names', 'retweets', 'favorites', 'links', 'links_first', 'image_links', 'image_links_first', 'rp_user_id', 'rp_user_name', 'location', 'tweet_link', 'search']
# Expected output type: is list[category], this will be checked.
return | 20250129013714 |
14 | Who are the authors of the 4 shortest posts (based on the number of words)? | 050_ING | dev | list[category] | ['author_name', 'text'] | 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": "int64"
},
{
"name": "author_name",
"type": "category"
},
{
"name": "author_handler",
"type": "category"
},
{
"name": "author_avatar",
"type": "category"
},
{
"name": "lang",
"type": "category"
},
{
"name": "type",
"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": "uint8"
},
{
"name": "favorites",
"type": "uint8"
},
{
"name": "links",
"type": "object"
},
{
"name": "links_first",
"type": "category"
},
{
"name": "image_links",
"type": "object"
},
{
"name": "image_links_first",
"type": "category"
},
{
"name": "rp_user_id",
"type": "float64"
},
{
"name": "rp_user_name",
"type": "category"
},
{
"name": "location",
"type": "category"
},
{
"name": "tweet_link",
"type": "category"
},
{
"name": "search",
"type": "category"
}
]
}
# Description of dataframe columns.
df_descrption = {
"count":{
"id":7244.0,
"author_id":7244.0,
"retweets":7244.0,
"favorites":7244.0,
"rp_user_id":4094.0
},
"mean":{
"id":1.129999764e+18,
"author_id":1.456169002e+17,
"retweets":0.1715902816,
"favorites":0.6188569851,
"rp_user_id":270815203.0
},
"std":{
"id":2.920544101e+16,
"author_id":3.490773128e+17,
"retweets":0.7395750951,
"favorites":1.8434020668,
"rp_user_id":0.0
},
"min":{
"id":1.079908205e+18,
"author_id":7007.0,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"25%":{
"id":1.10505894e+18,
"author_id":140041809.75,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"50%":{
"id":1.124196559e+18,
"author_id":318183125.5,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"75%":{
"id":1.158378457e+18,
"author_id":1901654083.0,
"retweets":0.0,
"favorites":1.0,
"rp_user_id":270815203.0
},
"max":{
"id":1.176868218e+18,
"author_id":1.175435395e+18,
"retweets":17.0,
"favorites":41.0,
"rp_user_id":270815203.0
}
}
# Randome sample of 10 rows from the dataframe.
df_random_sample = {
"count":{
"id":7244.0,
"author_id":7244.0,
"retweets":7244.0,
"favorites":7244.0,
"rp_user_id":4094.0
},
"mean":{
"id":1.129999764e+18,
"author_id":1.456169002e+17,
"retweets":0.1715902816,
"favorites":0.6188569851,
"rp_user_id":270815203.0
},
"std":{
"id":2.920544101e+16,
"author_id":3.490773128e+17,
"retweets":0.7395750951,
"favorites":1.8434020668,
"rp_user_id":0.0
},
"min":{
"id":1.079908205e+18,
"author_id":7007.0,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"25%":{
"id":1.10505894e+18,
"author_id":140041809.75,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"50%":{
"id":1.124196559e+18,
"author_id":318183125.5,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"75%":{
"id":1.158378457e+18,
"author_id":1901654083.0,
"retweets":0.0,
"favorites":1.0,
"rp_user_id":270815203.0
},
"max":{
"id":1.176868218e+18,
"author_id":1.175435395e+18,
"retweets":17.0,
"favorites":41.0,
"rp_user_id":270815203.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: Who are the authors of the 4 shortest posts (based on the number of words)?
# The answer should only contain python code, you are not allowed leave any TODO undone.
def answer(df: pd.DataFrame):
# Use df to answer: Who are the authors of the 4 shortest posts (based on the number of words)?
df.columns = ['id', 'author_id', 'author_name', 'author_handler', 'author_avatar', 'lang', 'type', 'text', 'date', 'mention_ids', 'mention_names', 'retweets', 'favorites', 'links', 'links_first', 'image_links', 'image_links_first', 'rp_user_id', 'rp_user_name', 'location', 'tweet_link', 'search']
# Expected output type: is list[category], this will be checked.
return | 20250129013714 |
15 | What types of posts are the 6 most common in the dataset? | 050_ING | dev | list[category] | ['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": "id",
"type": "int64"
},
{
"name": "author_id",
"type": "int64"
},
{
"name": "author_name",
"type": "category"
},
{
"name": "author_handler",
"type": "category"
},
{
"name": "author_avatar",
"type": "category"
},
{
"name": "lang",
"type": "category"
},
{
"name": "type",
"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": "uint8"
},
{
"name": "favorites",
"type": "uint8"
},
{
"name": "links",
"type": "object"
},
{
"name": "links_first",
"type": "category"
},
{
"name": "image_links",
"type": "object"
},
{
"name": "image_links_first",
"type": "category"
},
{
"name": "rp_user_id",
"type": "float64"
},
{
"name": "rp_user_name",
"type": "category"
},
{
"name": "location",
"type": "category"
},
{
"name": "tweet_link",
"type": "category"
},
{
"name": "search",
"type": "category"
}
]
}
# Description of dataframe columns.
df_descrption = {
"count":{
"id":7244.0,
"author_id":7244.0,
"retweets":7244.0,
"favorites":7244.0,
"rp_user_id":4094.0
},
"mean":{
"id":1.129999764e+18,
"author_id":1.456169002e+17,
"retweets":0.1715902816,
"favorites":0.6188569851,
"rp_user_id":270815203.0
},
"std":{
"id":2.920544101e+16,
"author_id":3.490773128e+17,
"retweets":0.7395750951,
"favorites":1.8434020668,
"rp_user_id":0.0
},
"min":{
"id":1.079908205e+18,
"author_id":7007.0,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"25%":{
"id":1.10505894e+18,
"author_id":140041809.75,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"50%":{
"id":1.124196559e+18,
"author_id":318183125.5,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"75%":{
"id":1.158378457e+18,
"author_id":1901654083.0,
"retweets":0.0,
"favorites":1.0,
"rp_user_id":270815203.0
},
"max":{
"id":1.176868218e+18,
"author_id":1.175435395e+18,
"retweets":17.0,
"favorites":41.0,
"rp_user_id":270815203.0
}
}
# Randome sample of 10 rows from the dataframe.
df_random_sample = {
"count":{
"id":7244.0,
"author_id":7244.0,
"retweets":7244.0,
"favorites":7244.0,
"rp_user_id":4094.0
},
"mean":{
"id":1.129999764e+18,
"author_id":1.456169002e+17,
"retweets":0.1715902816,
"favorites":0.6188569851,
"rp_user_id":270815203.0
},
"std":{
"id":2.920544101e+16,
"author_id":3.490773128e+17,
"retweets":0.7395750951,
"favorites":1.8434020668,
"rp_user_id":0.0
},
"min":{
"id":1.079908205e+18,
"author_id":7007.0,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"25%":{
"id":1.10505894e+18,
"author_id":140041809.75,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"50%":{
"id":1.124196559e+18,
"author_id":318183125.5,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"75%":{
"id":1.158378457e+18,
"author_id":1901654083.0,
"retweets":0.0,
"favorites":1.0,
"rp_user_id":270815203.0
},
"max":{
"id":1.176868218e+18,
"author_id":1.175435395e+18,
"retweets":17.0,
"favorites":41.0,
"rp_user_id":270815203.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 types of posts are the 6 most common 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: What types of posts are the 6 most common in the dataset?
df.columns = ['id', 'author_id', 'author_name', 'author_handler', 'author_avatar', 'lang', 'type', 'text', 'date', 'mention_ids', 'mention_names', 'retweets', 'favorites', 'links', 'links_first', 'image_links', 'image_links_first', 'rp_user_id', 'rp_user_name', 'location', 'tweet_link', 'search']
# Expected output type: is list[category], this will be checked.
return | 20250129013714 |
16 | What are the retweet counts for the top 5 most favorited posts? | 050_ING | dev | list[number] | ['retweets', '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": "int64"
},
{
"name": "author_name",
"type": "category"
},
{
"name": "author_handler",
"type": "category"
},
{
"name": "author_avatar",
"type": "category"
},
{
"name": "lang",
"type": "category"
},
{
"name": "type",
"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": "uint8"
},
{
"name": "favorites",
"type": "uint8"
},
{
"name": "links",
"type": "object"
},
{
"name": "links_first",
"type": "category"
},
{
"name": "image_links",
"type": "object"
},
{
"name": "image_links_first",
"type": "category"
},
{
"name": "rp_user_id",
"type": "float64"
},
{
"name": "rp_user_name",
"type": "category"
},
{
"name": "location",
"type": "category"
},
{
"name": "tweet_link",
"type": "category"
},
{
"name": "search",
"type": "category"
}
]
}
# Description of dataframe columns.
df_descrption = {
"count":{
"id":7244.0,
"author_id":7244.0,
"retweets":7244.0,
"favorites":7244.0,
"rp_user_id":4094.0
},
"mean":{
"id":1.129999764e+18,
"author_id":1.456169002e+17,
"retweets":0.1715902816,
"favorites":0.6188569851,
"rp_user_id":270815203.0
},
"std":{
"id":2.920544101e+16,
"author_id":3.490773128e+17,
"retweets":0.7395750951,
"favorites":1.8434020668,
"rp_user_id":0.0
},
"min":{
"id":1.079908205e+18,
"author_id":7007.0,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"25%":{
"id":1.10505894e+18,
"author_id":140041809.75,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"50%":{
"id":1.124196559e+18,
"author_id":318183125.5,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"75%":{
"id":1.158378457e+18,
"author_id":1901654083.0,
"retweets":0.0,
"favorites":1.0,
"rp_user_id":270815203.0
},
"max":{
"id":1.176868218e+18,
"author_id":1.175435395e+18,
"retweets":17.0,
"favorites":41.0,
"rp_user_id":270815203.0
}
}
# Randome sample of 10 rows from the dataframe.
df_random_sample = {
"count":{
"id":7244.0,
"author_id":7244.0,
"retweets":7244.0,
"favorites":7244.0,
"rp_user_id":4094.0
},
"mean":{
"id":1.129999764e+18,
"author_id":1.456169002e+17,
"retweets":0.1715902816,
"favorites":0.6188569851,
"rp_user_id":270815203.0
},
"std":{
"id":2.920544101e+16,
"author_id":3.490773128e+17,
"retweets":0.7395750951,
"favorites":1.8434020668,
"rp_user_id":0.0
},
"min":{
"id":1.079908205e+18,
"author_id":7007.0,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"25%":{
"id":1.10505894e+18,
"author_id":140041809.75,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"50%":{
"id":1.124196559e+18,
"author_id":318183125.5,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"75%":{
"id":1.158378457e+18,
"author_id":1901654083.0,
"retweets":0.0,
"favorites":1.0,
"rp_user_id":270815203.0
},
"max":{
"id":1.176868218e+18,
"author_id":1.175435395e+18,
"retweets":17.0,
"favorites":41.0,
"rp_user_id":270815203.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 retweet counts for the top 5 most favorited posts?
# 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 retweet counts for the top 5 most favorited posts?
df.columns = ['id', 'author_id', 'author_name', 'author_handler', 'author_avatar', 'lang', 'type', 'text', 'date', 'mention_ids', 'mention_names', 'retweets', 'favorites', 'links', 'links_first', 'image_links', 'image_links_first', 'rp_user_id', 'rp_user_name', 'location', 'tweet_link', 'search']
# Expected output type: is list[number], this will be checked.
return | 20250129013714 |
17 | What are the word counts of the 3 longest posts? | 050_ING | dev | list[number] | ['text'] | 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": "int64"
},
{
"name": "author_name",
"type": "category"
},
{
"name": "author_handler",
"type": "category"
},
{
"name": "author_avatar",
"type": "category"
},
{
"name": "lang",
"type": "category"
},
{
"name": "type",
"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": "uint8"
},
{
"name": "favorites",
"type": "uint8"
},
{
"name": "links",
"type": "object"
},
{
"name": "links_first",
"type": "category"
},
{
"name": "image_links",
"type": "object"
},
{
"name": "image_links_first",
"type": "category"
},
{
"name": "rp_user_id",
"type": "float64"
},
{
"name": "rp_user_name",
"type": "category"
},
{
"name": "location",
"type": "category"
},
{
"name": "tweet_link",
"type": "category"
},
{
"name": "search",
"type": "category"
}
]
}
# Description of dataframe columns.
df_descrption = {
"count":{
"id":7244.0,
"author_id":7244.0,
"retweets":7244.0,
"favorites":7244.0,
"rp_user_id":4094.0
},
"mean":{
"id":1.129999764e+18,
"author_id":1.456169002e+17,
"retweets":0.1715902816,
"favorites":0.6188569851,
"rp_user_id":270815203.0
},
"std":{
"id":2.920544101e+16,
"author_id":3.490773128e+17,
"retweets":0.7395750951,
"favorites":1.8434020668,
"rp_user_id":0.0
},
"min":{
"id":1.079908205e+18,
"author_id":7007.0,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"25%":{
"id":1.10505894e+18,
"author_id":140041809.75,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"50%":{
"id":1.124196559e+18,
"author_id":318183125.5,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"75%":{
"id":1.158378457e+18,
"author_id":1901654083.0,
"retweets":0.0,
"favorites":1.0,
"rp_user_id":270815203.0
},
"max":{
"id":1.176868218e+18,
"author_id":1.175435395e+18,
"retweets":17.0,
"favorites":41.0,
"rp_user_id":270815203.0
}
}
# Randome sample of 10 rows from the dataframe.
df_random_sample = {
"count":{
"id":7244.0,
"author_id":7244.0,
"retweets":7244.0,
"favorites":7244.0,
"rp_user_id":4094.0
},
"mean":{
"id":1.129999764e+18,
"author_id":1.456169002e+17,
"retweets":0.1715902816,
"favorites":0.6188569851,
"rp_user_id":270815203.0
},
"std":{
"id":2.920544101e+16,
"author_id":3.490773128e+17,
"retweets":0.7395750951,
"favorites":1.8434020668,
"rp_user_id":0.0
},
"min":{
"id":1.079908205e+18,
"author_id":7007.0,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"25%":{
"id":1.10505894e+18,
"author_id":140041809.75,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"50%":{
"id":1.124196559e+18,
"author_id":318183125.5,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"75%":{
"id":1.158378457e+18,
"author_id":1901654083.0,
"retweets":0.0,
"favorites":1.0,
"rp_user_id":270815203.0
},
"max":{
"id":1.176868218e+18,
"author_id":1.175435395e+18,
"retweets":17.0,
"favorites":41.0,
"rp_user_id":270815203.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 word counts of the 3 longest posts?
# 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 word counts of the 3 longest posts?
df.columns = ['id', 'author_id', 'author_name', 'author_handler', 'author_avatar', 'lang', 'type', 'text', 'date', 'mention_ids', 'mention_names', 'retweets', 'favorites', 'links', 'links_first', 'image_links', 'image_links_first', 'rp_user_id', 'rp_user_name', 'location', 'tweet_link', 'search']
# Expected output type: is list[number], this will be checked.
return | 20250129013714 |
18 | What are the retweet counts of the 4 least favorited posts? | 050_ING | dev | list[number] | ['retweets', '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": "int64"
},
{
"name": "author_name",
"type": "category"
},
{
"name": "author_handler",
"type": "category"
},
{
"name": "author_avatar",
"type": "category"
},
{
"name": "lang",
"type": "category"
},
{
"name": "type",
"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": "uint8"
},
{
"name": "favorites",
"type": "uint8"
},
{
"name": "links",
"type": "object"
},
{
"name": "links_first",
"type": "category"
},
{
"name": "image_links",
"type": "object"
},
{
"name": "image_links_first",
"type": "category"
},
{
"name": "rp_user_id",
"type": "float64"
},
{
"name": "rp_user_name",
"type": "category"
},
{
"name": "location",
"type": "category"
},
{
"name": "tweet_link",
"type": "category"
},
{
"name": "search",
"type": "category"
}
]
}
# Description of dataframe columns.
df_descrption = {
"count":{
"id":7244.0,
"author_id":7244.0,
"retweets":7244.0,
"favorites":7244.0,
"rp_user_id":4094.0
},
"mean":{
"id":1.129999764e+18,
"author_id":1.456169002e+17,
"retweets":0.1715902816,
"favorites":0.6188569851,
"rp_user_id":270815203.0
},
"std":{
"id":2.920544101e+16,
"author_id":3.490773128e+17,
"retweets":0.7395750951,
"favorites":1.8434020668,
"rp_user_id":0.0
},
"min":{
"id":1.079908205e+18,
"author_id":7007.0,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"25%":{
"id":1.10505894e+18,
"author_id":140041809.75,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"50%":{
"id":1.124196559e+18,
"author_id":318183125.5,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"75%":{
"id":1.158378457e+18,
"author_id":1901654083.0,
"retweets":0.0,
"favorites":1.0,
"rp_user_id":270815203.0
},
"max":{
"id":1.176868218e+18,
"author_id":1.175435395e+18,
"retweets":17.0,
"favorites":41.0,
"rp_user_id":270815203.0
}
}
# Randome sample of 10 rows from the dataframe.
df_random_sample = {
"count":{
"id":7244.0,
"author_id":7244.0,
"retweets":7244.0,
"favorites":7244.0,
"rp_user_id":4094.0
},
"mean":{
"id":1.129999764e+18,
"author_id":1.456169002e+17,
"retweets":0.1715902816,
"favorites":0.6188569851,
"rp_user_id":270815203.0
},
"std":{
"id":2.920544101e+16,
"author_id":3.490773128e+17,
"retweets":0.7395750951,
"favorites":1.8434020668,
"rp_user_id":0.0
},
"min":{
"id":1.079908205e+18,
"author_id":7007.0,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"25%":{
"id":1.10505894e+18,
"author_id":140041809.75,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"50%":{
"id":1.124196559e+18,
"author_id":318183125.5,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"75%":{
"id":1.158378457e+18,
"author_id":1901654083.0,
"retweets":0.0,
"favorites":1.0,
"rp_user_id":270815203.0
},
"max":{
"id":1.176868218e+18,
"author_id":1.175435395e+18,
"retweets":17.0,
"favorites":41.0,
"rp_user_id":270815203.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 retweet counts of the 4 least favorited posts?
# 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 retweet counts of the 4 least favorited posts?
df.columns = ['id', 'author_id', 'author_name', 'author_handler', 'author_avatar', 'lang', 'type', 'text', 'date', 'mention_ids', 'mention_names', 'retweets', 'favorites', 'links', 'links_first', 'image_links', 'image_links_first', 'rp_user_id', 'rp_user_name', 'location', 'tweet_link', 'search']
# Expected output type: is list[number], this will be checked.
return | 20250129013714 |
19 | What are the word counts for the 6 shortest posts? | 050_ING | dev | list[number] | ['text'] | 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": "int64"
},
{
"name": "author_name",
"type": "category"
},
{
"name": "author_handler",
"type": "category"
},
{
"name": "author_avatar",
"type": "category"
},
{
"name": "lang",
"type": "category"
},
{
"name": "type",
"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": "uint8"
},
{
"name": "favorites",
"type": "uint8"
},
{
"name": "links",
"type": "object"
},
{
"name": "links_first",
"type": "category"
},
{
"name": "image_links",
"type": "object"
},
{
"name": "image_links_first",
"type": "category"
},
{
"name": "rp_user_id",
"type": "float64"
},
{
"name": "rp_user_name",
"type": "category"
},
{
"name": "location",
"type": "category"
},
{
"name": "tweet_link",
"type": "category"
},
{
"name": "search",
"type": "category"
}
]
}
# Description of dataframe columns.
df_descrption = {
"count":{
"id":7244.0,
"author_id":7244.0,
"retweets":7244.0,
"favorites":7244.0,
"rp_user_id":4094.0
},
"mean":{
"id":1.129999764e+18,
"author_id":1.456169002e+17,
"retweets":0.1715902816,
"favorites":0.6188569851,
"rp_user_id":270815203.0
},
"std":{
"id":2.920544101e+16,
"author_id":3.490773128e+17,
"retweets":0.7395750951,
"favorites":1.8434020668,
"rp_user_id":0.0
},
"min":{
"id":1.079908205e+18,
"author_id":7007.0,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"25%":{
"id":1.10505894e+18,
"author_id":140041809.75,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"50%":{
"id":1.124196559e+18,
"author_id":318183125.5,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"75%":{
"id":1.158378457e+18,
"author_id":1901654083.0,
"retweets":0.0,
"favorites":1.0,
"rp_user_id":270815203.0
},
"max":{
"id":1.176868218e+18,
"author_id":1.175435395e+18,
"retweets":17.0,
"favorites":41.0,
"rp_user_id":270815203.0
}
}
# Randome sample of 10 rows from the dataframe.
df_random_sample = {
"count":{
"id":7244.0,
"author_id":7244.0,
"retweets":7244.0,
"favorites":7244.0,
"rp_user_id":4094.0
},
"mean":{
"id":1.129999764e+18,
"author_id":1.456169002e+17,
"retweets":0.1715902816,
"favorites":0.6188569851,
"rp_user_id":270815203.0
},
"std":{
"id":2.920544101e+16,
"author_id":3.490773128e+17,
"retweets":0.7395750951,
"favorites":1.8434020668,
"rp_user_id":0.0
},
"min":{
"id":1.079908205e+18,
"author_id":7007.0,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"25%":{
"id":1.10505894e+18,
"author_id":140041809.75,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"50%":{
"id":1.124196559e+18,
"author_id":318183125.5,
"retweets":0.0,
"favorites":0.0,
"rp_user_id":270815203.0
},
"75%":{
"id":1.158378457e+18,
"author_id":1901654083.0,
"retweets":0.0,
"favorites":1.0,
"rp_user_id":270815203.0
},
"max":{
"id":1.176868218e+18,
"author_id":1.175435395e+18,
"retweets":17.0,
"favorites":41.0,
"rp_user_id":270815203.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 word counts for the 6 shortest posts?
# 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 word counts for the 6 shortest posts?
df.columns = ['id', 'author_id', 'author_name', 'author_handler', 'author_avatar', 'lang', 'type', 'text', 'date', 'mention_ids', 'mention_names', 'retweets', 'favorites', 'links', 'links_first', 'image_links', 'image_links_first', 'rp_user_id', 'rp_user_name', 'location', 'tweet_link', 'search']
# Expected output type: is list[number], this will be checked.
return | 20250129013714 |
20 | Is there a Pokémon named 'Pikachu' in the dataset? | 051_Pokemon | dev | boolean | ['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": "number",
"type": "uint16"
},
{
"name": "name",
"type": "category"
},
{
"name": "type1",
"type": "category"
},
{
"name": "type2",
"type": "category"
},
{
"name": "total",
"type": "uint16"
},
{
"name": "hp",
"type": "uint8"
},
{
"name": "attack",
"type": "uint8"
},
{
"name": "defense",
"type": "uint8"
},
{
"name": "sp_attack",
"type": "uint8"
},
{
"name": "sp_defense",
"type": "uint8"
},
{
"name": "speed",
"type": "uint8"
},
{
"name": "generation",
"type": "uint8"
},
{
"name": "legendary",
"type": "bool"
}
]
}
# Description of dataframe columns.
df_descrption = {
"count":{
"number":1072.0,
"total":1072.0,
"hp":1072.0,
"attack":1072.0,
"defense":1072.0,
"sp_attack":1072.0,
"sp_defense":1072.0,
"speed":1072.0,
"generation":1072.0
},
"mean":{
"number":445.2192164179,
"total":440.885261194,
"hp":70.4869402985,
"attack":80.9384328358,
"defense":74.9682835821,
"sp_attack":73.2733208955,
"sp_defense":72.4766791045,
"speed":68.7929104478,
"generation":4.2947761194
},
"std":{
"number":267.77280649,
"total":121.3790771926,
"hp":26.8680389923,
"attack":32.4635820748,
"defense":31.2080593873,
"sp_attack":32.6431190064,
"sp_defense":27.9342534926,
"speed":30.0762806451,
"generation":2.3464717631
},
"min":{
"number":1.0,
"total":175.0,
"hp":1.0,
"attack":5.0,
"defense":5.0,
"sp_attack":10.0,
"sp_defense":20.0,
"speed":5.0,
"generation":0.0
},
"25%":{
"number":209.75,
"total":330.0,
"hp":50.0,
"attack":56.0,
"defense":52.0,
"sp_attack":50.0,
"sp_defense":50.0,
"speed":45.0,
"generation":2.0
},
"50%":{
"number":442.5,
"total":460.5,
"hp":68.0,
"attack":80.0,
"defense":70.0,
"sp_attack":65.0,
"sp_defense":70.0,
"speed":65.0,
"generation":4.0
},
"75%":{
"number":681.25,
"total":519.25,
"hp":84.0,
"attack":100.0,
"defense":90.0,
"sp_attack":95.0,
"sp_defense":90.0,
"speed":90.0,
"generation":6.0
},
"max":{
"number":898.0,
"total":1125.0,
"hp":255.0,
"attack":190.0,
"defense":250.0,
"sp_attack":194.0,
"sp_defense":250.0,
"speed":200.0,
"generation":8.0
}
}
# Randome sample of 10 rows from the dataframe.
df_random_sample = {
"count":{
"number":1072.0,
"total":1072.0,
"hp":1072.0,
"attack":1072.0,
"defense":1072.0,
"sp_attack":1072.0,
"sp_defense":1072.0,
"speed":1072.0,
"generation":1072.0
},
"mean":{
"number":445.2192164179,
"total":440.885261194,
"hp":70.4869402985,
"attack":80.9384328358,
"defense":74.9682835821,
"sp_attack":73.2733208955,
"sp_defense":72.4766791045,
"speed":68.7929104478,
"generation":4.2947761194
},
"std":{
"number":267.77280649,
"total":121.3790771926,
"hp":26.8680389923,
"attack":32.4635820748,
"defense":31.2080593873,
"sp_attack":32.6431190064,
"sp_defense":27.9342534926,
"speed":30.0762806451,
"generation":2.3464717631
},
"min":{
"number":1.0,
"total":175.0,
"hp":1.0,
"attack":5.0,
"defense":5.0,
"sp_attack":10.0,
"sp_defense":20.0,
"speed":5.0,
"generation":0.0
},
"25%":{
"number":209.75,
"total":330.0,
"hp":50.0,
"attack":56.0,
"defense":52.0,
"sp_attack":50.0,
"sp_defense":50.0,
"speed":45.0,
"generation":2.0
},
"50%":{
"number":442.5,
"total":460.5,
"hp":68.0,
"attack":80.0,
"defense":70.0,
"sp_attack":65.0,
"sp_defense":70.0,
"speed":65.0,
"generation":4.0
},
"75%":{
"number":681.25,
"total":519.25,
"hp":84.0,
"attack":100.0,
"defense":90.0,
"sp_attack":95.0,
"sp_defense":90.0,
"speed":90.0,
"generation":6.0
},
"max":{
"number":898.0,
"total":1125.0,
"hp":255.0,
"attack":190.0,
"defense":250.0,
"sp_attack":194.0,
"sp_defense":250.0,
"speed":200.0,
"generation":8.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 a Pokémon named 'Pikachu' 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: Is there a Pokémon named 'Pikachu' in the dataset?
df.columns = ['number', 'name', 'type1', 'type2', 'total', 'hp', 'attack', 'defense', 'sp_attack', 'sp_defense', 'speed', 'generation', 'legendary']
# Expected output type: is boolean, this will be checked.
return | 20250129013714 |
21 | Are there any Pokémon with a total stat greater than 700? | 051_Pokemon | dev | boolean | ['total'] | 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": "number",
"type": "uint16"
},
{
"name": "name",
"type": "category"
},
{
"name": "type1",
"type": "category"
},
{
"name": "type2",
"type": "category"
},
{
"name": "total",
"type": "uint16"
},
{
"name": "hp",
"type": "uint8"
},
{
"name": "attack",
"type": "uint8"
},
{
"name": "defense",
"type": "uint8"
},
{
"name": "sp_attack",
"type": "uint8"
},
{
"name": "sp_defense",
"type": "uint8"
},
{
"name": "speed",
"type": "uint8"
},
{
"name": "generation",
"type": "uint8"
},
{
"name": "legendary",
"type": "bool"
}
]
}
# Description of dataframe columns.
df_descrption = {
"count":{
"number":1072.0,
"total":1072.0,
"hp":1072.0,
"attack":1072.0,
"defense":1072.0,
"sp_attack":1072.0,
"sp_defense":1072.0,
"speed":1072.0,
"generation":1072.0
},
"mean":{
"number":445.2192164179,
"total":440.885261194,
"hp":70.4869402985,
"attack":80.9384328358,
"defense":74.9682835821,
"sp_attack":73.2733208955,
"sp_defense":72.4766791045,
"speed":68.7929104478,
"generation":4.2947761194
},
"std":{
"number":267.77280649,
"total":121.3790771926,
"hp":26.8680389923,
"attack":32.4635820748,
"defense":31.2080593873,
"sp_attack":32.6431190064,
"sp_defense":27.9342534926,
"speed":30.0762806451,
"generation":2.3464717631
},
"min":{
"number":1.0,
"total":175.0,
"hp":1.0,
"attack":5.0,
"defense":5.0,
"sp_attack":10.0,
"sp_defense":20.0,
"speed":5.0,
"generation":0.0
},
"25%":{
"number":209.75,
"total":330.0,
"hp":50.0,
"attack":56.0,
"defense":52.0,
"sp_attack":50.0,
"sp_defense":50.0,
"speed":45.0,
"generation":2.0
},
"50%":{
"number":442.5,
"total":460.5,
"hp":68.0,
"attack":80.0,
"defense":70.0,
"sp_attack":65.0,
"sp_defense":70.0,
"speed":65.0,
"generation":4.0
},
"75%":{
"number":681.25,
"total":519.25,
"hp":84.0,
"attack":100.0,
"defense":90.0,
"sp_attack":95.0,
"sp_defense":90.0,
"speed":90.0,
"generation":6.0
},
"max":{
"number":898.0,
"total":1125.0,
"hp":255.0,
"attack":190.0,
"defense":250.0,
"sp_attack":194.0,
"sp_defense":250.0,
"speed":200.0,
"generation":8.0
}
}
# Randome sample of 10 rows from the dataframe.
df_random_sample = {
"count":{
"number":1072.0,
"total":1072.0,
"hp":1072.0,
"attack":1072.0,
"defense":1072.0,
"sp_attack":1072.0,
"sp_defense":1072.0,
"speed":1072.0,
"generation":1072.0
},
"mean":{
"number":445.2192164179,
"total":440.885261194,
"hp":70.4869402985,
"attack":80.9384328358,
"defense":74.9682835821,
"sp_attack":73.2733208955,
"sp_defense":72.4766791045,
"speed":68.7929104478,
"generation":4.2947761194
},
"std":{
"number":267.77280649,
"total":121.3790771926,
"hp":26.8680389923,
"attack":32.4635820748,
"defense":31.2080593873,
"sp_attack":32.6431190064,
"sp_defense":27.9342534926,
"speed":30.0762806451,
"generation":2.3464717631
},
"min":{
"number":1.0,
"total":175.0,
"hp":1.0,
"attack":5.0,
"defense":5.0,
"sp_attack":10.0,
"sp_defense":20.0,
"speed":5.0,
"generation":0.0
},
"25%":{
"number":209.75,
"total":330.0,
"hp":50.0,
"attack":56.0,
"defense":52.0,
"sp_attack":50.0,
"sp_defense":50.0,
"speed":45.0,
"generation":2.0
},
"50%":{
"number":442.5,
"total":460.5,
"hp":68.0,
"attack":80.0,
"defense":70.0,
"sp_attack":65.0,
"sp_defense":70.0,
"speed":65.0,
"generation":4.0
},
"75%":{
"number":681.25,
"total":519.25,
"hp":84.0,
"attack":100.0,
"defense":90.0,
"sp_attack":95.0,
"sp_defense":90.0,
"speed":90.0,
"generation":6.0
},
"max":{
"number":898.0,
"total":1125.0,
"hp":255.0,
"attack":190.0,
"defense":250.0,
"sp_attack":194.0,
"sp_defense":250.0,
"speed":200.0,
"generation":8.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 Pokémon with a total stat greater than 700?
# 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 Pokémon with a total stat greater than 700?
df.columns = ['number', 'name', 'type1', 'type2', 'total', 'hp', 'attack', 'defense', 'sp_attack', 'sp_defense', 'speed', 'generation', 'legendary']
# Expected output type: is boolean, this will be checked.
return | 20250129013714 |
22 | Are all Pokémon in the first generation legendary? | 051_Pokemon | dev | boolean | ['generation', 'legendary'] | 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": "number",
"type": "uint16"
},
{
"name": "name",
"type": "category"
},
{
"name": "type1",
"type": "category"
},
{
"name": "type2",
"type": "category"
},
{
"name": "total",
"type": "uint16"
},
{
"name": "hp",
"type": "uint8"
},
{
"name": "attack",
"type": "uint8"
},
{
"name": "defense",
"type": "uint8"
},
{
"name": "sp_attack",
"type": "uint8"
},
{
"name": "sp_defense",
"type": "uint8"
},
{
"name": "speed",
"type": "uint8"
},
{
"name": "generation",
"type": "uint8"
},
{
"name": "legendary",
"type": "bool"
}
]
}
# Description of dataframe columns.
df_descrption = {
"count":{
"number":1072.0,
"total":1072.0,
"hp":1072.0,
"attack":1072.0,
"defense":1072.0,
"sp_attack":1072.0,
"sp_defense":1072.0,
"speed":1072.0,
"generation":1072.0
},
"mean":{
"number":445.2192164179,
"total":440.885261194,
"hp":70.4869402985,
"attack":80.9384328358,
"defense":74.9682835821,
"sp_attack":73.2733208955,
"sp_defense":72.4766791045,
"speed":68.7929104478,
"generation":4.2947761194
},
"std":{
"number":267.77280649,
"total":121.3790771926,
"hp":26.8680389923,
"attack":32.4635820748,
"defense":31.2080593873,
"sp_attack":32.6431190064,
"sp_defense":27.9342534926,
"speed":30.0762806451,
"generation":2.3464717631
},
"min":{
"number":1.0,
"total":175.0,
"hp":1.0,
"attack":5.0,
"defense":5.0,
"sp_attack":10.0,
"sp_defense":20.0,
"speed":5.0,
"generation":0.0
},
"25%":{
"number":209.75,
"total":330.0,
"hp":50.0,
"attack":56.0,
"defense":52.0,
"sp_attack":50.0,
"sp_defense":50.0,
"speed":45.0,
"generation":2.0
},
"50%":{
"number":442.5,
"total":460.5,
"hp":68.0,
"attack":80.0,
"defense":70.0,
"sp_attack":65.0,
"sp_defense":70.0,
"speed":65.0,
"generation":4.0
},
"75%":{
"number":681.25,
"total":519.25,
"hp":84.0,
"attack":100.0,
"defense":90.0,
"sp_attack":95.0,
"sp_defense":90.0,
"speed":90.0,
"generation":6.0
},
"max":{
"number":898.0,
"total":1125.0,
"hp":255.0,
"attack":190.0,
"defense":250.0,
"sp_attack":194.0,
"sp_defense":250.0,
"speed":200.0,
"generation":8.0
}
}
# Randome sample of 10 rows from the dataframe.
df_random_sample = {
"count":{
"number":1072.0,
"total":1072.0,
"hp":1072.0,
"attack":1072.0,
"defense":1072.0,
"sp_attack":1072.0,
"sp_defense":1072.0,
"speed":1072.0,
"generation":1072.0
},
"mean":{
"number":445.2192164179,
"total":440.885261194,
"hp":70.4869402985,
"attack":80.9384328358,
"defense":74.9682835821,
"sp_attack":73.2733208955,
"sp_defense":72.4766791045,
"speed":68.7929104478,
"generation":4.2947761194
},
"std":{
"number":267.77280649,
"total":121.3790771926,
"hp":26.8680389923,
"attack":32.4635820748,
"defense":31.2080593873,
"sp_attack":32.6431190064,
"sp_defense":27.9342534926,
"speed":30.0762806451,
"generation":2.3464717631
},
"min":{
"number":1.0,
"total":175.0,
"hp":1.0,
"attack":5.0,
"defense":5.0,
"sp_attack":10.0,
"sp_defense":20.0,
"speed":5.0,
"generation":0.0
},
"25%":{
"number":209.75,
"total":330.0,
"hp":50.0,
"attack":56.0,
"defense":52.0,
"sp_attack":50.0,
"sp_defense":50.0,
"speed":45.0,
"generation":2.0
},
"50%":{
"number":442.5,
"total":460.5,
"hp":68.0,
"attack":80.0,
"defense":70.0,
"sp_attack":65.0,
"sp_defense":70.0,
"speed":65.0,
"generation":4.0
},
"75%":{
"number":681.25,
"total":519.25,
"hp":84.0,
"attack":100.0,
"defense":90.0,
"sp_attack":95.0,
"sp_defense":90.0,
"speed":90.0,
"generation":6.0
},
"max":{
"number":898.0,
"total":1125.0,
"hp":255.0,
"attack":190.0,
"defense":250.0,
"sp_attack":194.0,
"sp_defense":250.0,
"speed":200.0,
"generation":8.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 Pokémon in the first generation legendary?
# 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 Pokémon in the first generation legendary?
df.columns = ['number', 'name', 'type1', 'type2', 'total', 'hp', 'attack', 'defense', 'sp_attack', 'sp_defense', 'speed', 'generation', 'legendary']
# Expected output type: is boolean, this will be checked.
return | 20250129013715 |
23 | Is there any Pokémon with a speed greater than 150? | 051_Pokemon | dev | boolean | ['speed'] | 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": "number",
"type": "uint16"
},
{
"name": "name",
"type": "category"
},
{
"name": "type1",
"type": "category"
},
{
"name": "type2",
"type": "category"
},
{
"name": "total",
"type": "uint16"
},
{
"name": "hp",
"type": "uint8"
},
{
"name": "attack",
"type": "uint8"
},
{
"name": "defense",
"type": "uint8"
},
{
"name": "sp_attack",
"type": "uint8"
},
{
"name": "sp_defense",
"type": "uint8"
},
{
"name": "speed",
"type": "uint8"
},
{
"name": "generation",
"type": "uint8"
},
{
"name": "legendary",
"type": "bool"
}
]
}
# Description of dataframe columns.
df_descrption = {
"count":{
"number":1072.0,
"total":1072.0,
"hp":1072.0,
"attack":1072.0,
"defense":1072.0,
"sp_attack":1072.0,
"sp_defense":1072.0,
"speed":1072.0,
"generation":1072.0
},
"mean":{
"number":445.2192164179,
"total":440.885261194,
"hp":70.4869402985,
"attack":80.9384328358,
"defense":74.9682835821,
"sp_attack":73.2733208955,
"sp_defense":72.4766791045,
"speed":68.7929104478,
"generation":4.2947761194
},
"std":{
"number":267.77280649,
"total":121.3790771926,
"hp":26.8680389923,
"attack":32.4635820748,
"defense":31.2080593873,
"sp_attack":32.6431190064,
"sp_defense":27.9342534926,
"speed":30.0762806451,
"generation":2.3464717631
},
"min":{
"number":1.0,
"total":175.0,
"hp":1.0,
"attack":5.0,
"defense":5.0,
"sp_attack":10.0,
"sp_defense":20.0,
"speed":5.0,
"generation":0.0
},
"25%":{
"number":209.75,
"total":330.0,
"hp":50.0,
"attack":56.0,
"defense":52.0,
"sp_attack":50.0,
"sp_defense":50.0,
"speed":45.0,
"generation":2.0
},
"50%":{
"number":442.5,
"total":460.5,
"hp":68.0,
"attack":80.0,
"defense":70.0,
"sp_attack":65.0,
"sp_defense":70.0,
"speed":65.0,
"generation":4.0
},
"75%":{
"number":681.25,
"total":519.25,
"hp":84.0,
"attack":100.0,
"defense":90.0,
"sp_attack":95.0,
"sp_defense":90.0,
"speed":90.0,
"generation":6.0
},
"max":{
"number":898.0,
"total":1125.0,
"hp":255.0,
"attack":190.0,
"defense":250.0,
"sp_attack":194.0,
"sp_defense":250.0,
"speed":200.0,
"generation":8.0
}
}
# Randome sample of 10 rows from the dataframe.
df_random_sample = {
"count":{
"number":1072.0,
"total":1072.0,
"hp":1072.0,
"attack":1072.0,
"defense":1072.0,
"sp_attack":1072.0,
"sp_defense":1072.0,
"speed":1072.0,
"generation":1072.0
},
"mean":{
"number":445.2192164179,
"total":440.885261194,
"hp":70.4869402985,
"attack":80.9384328358,
"defense":74.9682835821,
"sp_attack":73.2733208955,
"sp_defense":72.4766791045,
"speed":68.7929104478,
"generation":4.2947761194
},
"std":{
"number":267.77280649,
"total":121.3790771926,
"hp":26.8680389923,
"attack":32.4635820748,
"defense":31.2080593873,
"sp_attack":32.6431190064,
"sp_defense":27.9342534926,
"speed":30.0762806451,
"generation":2.3464717631
},
"min":{
"number":1.0,
"total":175.0,
"hp":1.0,
"attack":5.0,
"defense":5.0,
"sp_attack":10.0,
"sp_defense":20.0,
"speed":5.0,
"generation":0.0
},
"25%":{
"number":209.75,
"total":330.0,
"hp":50.0,
"attack":56.0,
"defense":52.0,
"sp_attack":50.0,
"sp_defense":50.0,
"speed":45.0,
"generation":2.0
},
"50%":{
"number":442.5,
"total":460.5,
"hp":68.0,
"attack":80.0,
"defense":70.0,
"sp_attack":65.0,
"sp_defense":70.0,
"speed":65.0,
"generation":4.0
},
"75%":{
"number":681.25,
"total":519.25,
"hp":84.0,
"attack":100.0,
"defense":90.0,
"sp_attack":95.0,
"sp_defense":90.0,
"speed":90.0,
"generation":6.0
},
"max":{
"number":898.0,
"total":1125.0,
"hp":255.0,
"attack":190.0,
"defense":250.0,
"sp_attack":194.0,
"sp_defense":250.0,
"speed":200.0,
"generation":8.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 Pokémon with a speed greater than 150?
# 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 Pokémon with a speed greater than 150?
df.columns = ['number', 'name', 'type1', 'type2', 'total', 'hp', 'attack', 'defense', 'sp_attack', 'sp_defense', 'speed', 'generation', 'legendary']
# Expected output type: is boolean, this will be checked.
return | 20250129013715 |
24 | How many unique Pokémon types are there in the 'type1' column? | 051_Pokemon | dev | number | ['type1'] | 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": "number",
"type": "uint16"
},
{
"name": "name",
"type": "category"
},
{
"name": "type1",
"type": "category"
},
{
"name": "type2",
"type": "category"
},
{
"name": "total",
"type": "uint16"
},
{
"name": "hp",
"type": "uint8"
},
{
"name": "attack",
"type": "uint8"
},
{
"name": "defense",
"type": "uint8"
},
{
"name": "sp_attack",
"type": "uint8"
},
{
"name": "sp_defense",
"type": "uint8"
},
{
"name": "speed",
"type": "uint8"
},
{
"name": "generation",
"type": "uint8"
},
{
"name": "legendary",
"type": "bool"
}
]
}
# Description of dataframe columns.
df_descrption = {
"count":{
"number":1072.0,
"total":1072.0,
"hp":1072.0,
"attack":1072.0,
"defense":1072.0,
"sp_attack":1072.0,
"sp_defense":1072.0,
"speed":1072.0,
"generation":1072.0
},
"mean":{
"number":445.2192164179,
"total":440.885261194,
"hp":70.4869402985,
"attack":80.9384328358,
"defense":74.9682835821,
"sp_attack":73.2733208955,
"sp_defense":72.4766791045,
"speed":68.7929104478,
"generation":4.2947761194
},
"std":{
"number":267.77280649,
"total":121.3790771926,
"hp":26.8680389923,
"attack":32.4635820748,
"defense":31.2080593873,
"sp_attack":32.6431190064,
"sp_defense":27.9342534926,
"speed":30.0762806451,
"generation":2.3464717631
},
"min":{
"number":1.0,
"total":175.0,
"hp":1.0,
"attack":5.0,
"defense":5.0,
"sp_attack":10.0,
"sp_defense":20.0,
"speed":5.0,
"generation":0.0
},
"25%":{
"number":209.75,
"total":330.0,
"hp":50.0,
"attack":56.0,
"defense":52.0,
"sp_attack":50.0,
"sp_defense":50.0,
"speed":45.0,
"generation":2.0
},
"50%":{
"number":442.5,
"total":460.5,
"hp":68.0,
"attack":80.0,
"defense":70.0,
"sp_attack":65.0,
"sp_defense":70.0,
"speed":65.0,
"generation":4.0
},
"75%":{
"number":681.25,
"total":519.25,
"hp":84.0,
"attack":100.0,
"defense":90.0,
"sp_attack":95.0,
"sp_defense":90.0,
"speed":90.0,
"generation":6.0
},
"max":{
"number":898.0,
"total":1125.0,
"hp":255.0,
"attack":190.0,
"defense":250.0,
"sp_attack":194.0,
"sp_defense":250.0,
"speed":200.0,
"generation":8.0
}
}
# Randome sample of 10 rows from the dataframe.
df_random_sample = {
"count":{
"number":1072.0,
"total":1072.0,
"hp":1072.0,
"attack":1072.0,
"defense":1072.0,
"sp_attack":1072.0,
"sp_defense":1072.0,
"speed":1072.0,
"generation":1072.0
},
"mean":{
"number":445.2192164179,
"total":440.885261194,
"hp":70.4869402985,
"attack":80.9384328358,
"defense":74.9682835821,
"sp_attack":73.2733208955,
"sp_defense":72.4766791045,
"speed":68.7929104478,
"generation":4.2947761194
},
"std":{
"number":267.77280649,
"total":121.3790771926,
"hp":26.8680389923,
"attack":32.4635820748,
"defense":31.2080593873,
"sp_attack":32.6431190064,
"sp_defense":27.9342534926,
"speed":30.0762806451,
"generation":2.3464717631
},
"min":{
"number":1.0,
"total":175.0,
"hp":1.0,
"attack":5.0,
"defense":5.0,
"sp_attack":10.0,
"sp_defense":20.0,
"speed":5.0,
"generation":0.0
},
"25%":{
"number":209.75,
"total":330.0,
"hp":50.0,
"attack":56.0,
"defense":52.0,
"sp_attack":50.0,
"sp_defense":50.0,
"speed":45.0,
"generation":2.0
},
"50%":{
"number":442.5,
"total":460.5,
"hp":68.0,
"attack":80.0,
"defense":70.0,
"sp_attack":65.0,
"sp_defense":70.0,
"speed":65.0,
"generation":4.0
},
"75%":{
"number":681.25,
"total":519.25,
"hp":84.0,
"attack":100.0,
"defense":90.0,
"sp_attack":95.0,
"sp_defense":90.0,
"speed":90.0,
"generation":6.0
},
"max":{
"number":898.0,
"total":1125.0,
"hp":255.0,
"attack":190.0,
"defense":250.0,
"sp_attack":194.0,
"sp_defense":250.0,
"speed":200.0,
"generation":8.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 Pokémon types are there in the 'type1' column?
# 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 Pokémon types are there in the 'type1' column?
df.columns = ['number', 'name', 'type1', 'type2', 'total', 'hp', 'attack', 'defense', 'sp_attack', 'sp_defense', 'speed', 'generation', 'legendary']
# Expected output type: is number, this will be checked.
return | 20250129013715 |
25 | What's the highest total stat value found in the dataset? | 051_Pokemon | dev | number | ['total'] | 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": "number",
"type": "uint16"
},
{
"name": "name",
"type": "category"
},
{
"name": "type1",
"type": "category"
},
{
"name": "type2",
"type": "category"
},
{
"name": "total",
"type": "uint16"
},
{
"name": "hp",
"type": "uint8"
},
{
"name": "attack",
"type": "uint8"
},
{
"name": "defense",
"type": "uint8"
},
{
"name": "sp_attack",
"type": "uint8"
},
{
"name": "sp_defense",
"type": "uint8"
},
{
"name": "speed",
"type": "uint8"
},
{
"name": "generation",
"type": "uint8"
},
{
"name": "legendary",
"type": "bool"
}
]
}
# Description of dataframe columns.
df_descrption = {
"count":{
"number":1072.0,
"total":1072.0,
"hp":1072.0,
"attack":1072.0,
"defense":1072.0,
"sp_attack":1072.0,
"sp_defense":1072.0,
"speed":1072.0,
"generation":1072.0
},
"mean":{
"number":445.2192164179,
"total":440.885261194,
"hp":70.4869402985,
"attack":80.9384328358,
"defense":74.9682835821,
"sp_attack":73.2733208955,
"sp_defense":72.4766791045,
"speed":68.7929104478,
"generation":4.2947761194
},
"std":{
"number":267.77280649,
"total":121.3790771926,
"hp":26.8680389923,
"attack":32.4635820748,
"defense":31.2080593873,
"sp_attack":32.6431190064,
"sp_defense":27.9342534926,
"speed":30.0762806451,
"generation":2.3464717631
},
"min":{
"number":1.0,
"total":175.0,
"hp":1.0,
"attack":5.0,
"defense":5.0,
"sp_attack":10.0,
"sp_defense":20.0,
"speed":5.0,
"generation":0.0
},
"25%":{
"number":209.75,
"total":330.0,
"hp":50.0,
"attack":56.0,
"defense":52.0,
"sp_attack":50.0,
"sp_defense":50.0,
"speed":45.0,
"generation":2.0
},
"50%":{
"number":442.5,
"total":460.5,
"hp":68.0,
"attack":80.0,
"defense":70.0,
"sp_attack":65.0,
"sp_defense":70.0,
"speed":65.0,
"generation":4.0
},
"75%":{
"number":681.25,
"total":519.25,
"hp":84.0,
"attack":100.0,
"defense":90.0,
"sp_attack":95.0,
"sp_defense":90.0,
"speed":90.0,
"generation":6.0
},
"max":{
"number":898.0,
"total":1125.0,
"hp":255.0,
"attack":190.0,
"defense":250.0,
"sp_attack":194.0,
"sp_defense":250.0,
"speed":200.0,
"generation":8.0
}
}
# Randome sample of 10 rows from the dataframe.
df_random_sample = {
"count":{
"number":1072.0,
"total":1072.0,
"hp":1072.0,
"attack":1072.0,
"defense":1072.0,
"sp_attack":1072.0,
"sp_defense":1072.0,
"speed":1072.0,
"generation":1072.0
},
"mean":{
"number":445.2192164179,
"total":440.885261194,
"hp":70.4869402985,
"attack":80.9384328358,
"defense":74.9682835821,
"sp_attack":73.2733208955,
"sp_defense":72.4766791045,
"speed":68.7929104478,
"generation":4.2947761194
},
"std":{
"number":267.77280649,
"total":121.3790771926,
"hp":26.8680389923,
"attack":32.4635820748,
"defense":31.2080593873,
"sp_attack":32.6431190064,
"sp_defense":27.9342534926,
"speed":30.0762806451,
"generation":2.3464717631
},
"min":{
"number":1.0,
"total":175.0,
"hp":1.0,
"attack":5.0,
"defense":5.0,
"sp_attack":10.0,
"sp_defense":20.0,
"speed":5.0,
"generation":0.0
},
"25%":{
"number":209.75,
"total":330.0,
"hp":50.0,
"attack":56.0,
"defense":52.0,
"sp_attack":50.0,
"sp_defense":50.0,
"speed":45.0,
"generation":2.0
},
"50%":{
"number":442.5,
"total":460.5,
"hp":68.0,
"attack":80.0,
"defense":70.0,
"sp_attack":65.0,
"sp_defense":70.0,
"speed":65.0,
"generation":4.0
},
"75%":{
"number":681.25,
"total":519.25,
"hp":84.0,
"attack":100.0,
"defense":90.0,
"sp_attack":95.0,
"sp_defense":90.0,
"speed":90.0,
"generation":6.0
},
"max":{
"number":898.0,
"total":1125.0,
"hp":255.0,
"attack":190.0,
"defense":250.0,
"sp_attack":194.0,
"sp_defense":250.0,
"speed":200.0,
"generation":8.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 total stat value found 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: What's the highest total stat value found in the dataset?
df.columns = ['number', 'name', 'type1', 'type2', 'total', 'hp', 'attack', 'defense', 'sp_attack', 'sp_defense', 'speed', 'generation', 'legendary']
# Expected output type: is number, this will be checked.
return | 20250129013715 |
26 | How many Pokémon are there in the third generation? | 051_Pokemon | dev | number | ['generation'] | 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": "number",
"type": "uint16"
},
{
"name": "name",
"type": "category"
},
{
"name": "type1",
"type": "category"
},
{
"name": "type2",
"type": "category"
},
{
"name": "total",
"type": "uint16"
},
{
"name": "hp",
"type": "uint8"
},
{
"name": "attack",
"type": "uint8"
},
{
"name": "defense",
"type": "uint8"
},
{
"name": "sp_attack",
"type": "uint8"
},
{
"name": "sp_defense",
"type": "uint8"
},
{
"name": "speed",
"type": "uint8"
},
{
"name": "generation",
"type": "uint8"
},
{
"name": "legendary",
"type": "bool"
}
]
}
# Description of dataframe columns.
df_descrption = {
"count":{
"number":1072.0,
"total":1072.0,
"hp":1072.0,
"attack":1072.0,
"defense":1072.0,
"sp_attack":1072.0,
"sp_defense":1072.0,
"speed":1072.0,
"generation":1072.0
},
"mean":{
"number":445.2192164179,
"total":440.885261194,
"hp":70.4869402985,
"attack":80.9384328358,
"defense":74.9682835821,
"sp_attack":73.2733208955,
"sp_defense":72.4766791045,
"speed":68.7929104478,
"generation":4.2947761194
},
"std":{
"number":267.77280649,
"total":121.3790771926,
"hp":26.8680389923,
"attack":32.4635820748,
"defense":31.2080593873,
"sp_attack":32.6431190064,
"sp_defense":27.9342534926,
"speed":30.0762806451,
"generation":2.3464717631
},
"min":{
"number":1.0,
"total":175.0,
"hp":1.0,
"attack":5.0,
"defense":5.0,
"sp_attack":10.0,
"sp_defense":20.0,
"speed":5.0,
"generation":0.0
},
"25%":{
"number":209.75,
"total":330.0,
"hp":50.0,
"attack":56.0,
"defense":52.0,
"sp_attack":50.0,
"sp_defense":50.0,
"speed":45.0,
"generation":2.0
},
"50%":{
"number":442.5,
"total":460.5,
"hp":68.0,
"attack":80.0,
"defense":70.0,
"sp_attack":65.0,
"sp_defense":70.0,
"speed":65.0,
"generation":4.0
},
"75%":{
"number":681.25,
"total":519.25,
"hp":84.0,
"attack":100.0,
"defense":90.0,
"sp_attack":95.0,
"sp_defense":90.0,
"speed":90.0,
"generation":6.0
},
"max":{
"number":898.0,
"total":1125.0,
"hp":255.0,
"attack":190.0,
"defense":250.0,
"sp_attack":194.0,
"sp_defense":250.0,
"speed":200.0,
"generation":8.0
}
}
# Randome sample of 10 rows from the dataframe.
df_random_sample = {
"count":{
"number":1072.0,
"total":1072.0,
"hp":1072.0,
"attack":1072.0,
"defense":1072.0,
"sp_attack":1072.0,
"sp_defense":1072.0,
"speed":1072.0,
"generation":1072.0
},
"mean":{
"number":445.2192164179,
"total":440.885261194,
"hp":70.4869402985,
"attack":80.9384328358,
"defense":74.9682835821,
"sp_attack":73.2733208955,
"sp_defense":72.4766791045,
"speed":68.7929104478,
"generation":4.2947761194
},
"std":{
"number":267.77280649,
"total":121.3790771926,
"hp":26.8680389923,
"attack":32.4635820748,
"defense":31.2080593873,
"sp_attack":32.6431190064,
"sp_defense":27.9342534926,
"speed":30.0762806451,
"generation":2.3464717631
},
"min":{
"number":1.0,
"total":175.0,
"hp":1.0,
"attack":5.0,
"defense":5.0,
"sp_attack":10.0,
"sp_defense":20.0,
"speed":5.0,
"generation":0.0
},
"25%":{
"number":209.75,
"total":330.0,
"hp":50.0,
"attack":56.0,
"defense":52.0,
"sp_attack":50.0,
"sp_defense":50.0,
"speed":45.0,
"generation":2.0
},
"50%":{
"number":442.5,
"total":460.5,
"hp":68.0,
"attack":80.0,
"defense":70.0,
"sp_attack":65.0,
"sp_defense":70.0,
"speed":65.0,
"generation":4.0
},
"75%":{
"number":681.25,
"total":519.25,
"hp":84.0,
"attack":100.0,
"defense":90.0,
"sp_attack":95.0,
"sp_defense":90.0,
"speed":90.0,
"generation":6.0
},
"max":{
"number":898.0,
"total":1125.0,
"hp":255.0,
"attack":190.0,
"defense":250.0,
"sp_attack":194.0,
"sp_defense":250.0,
"speed":200.0,
"generation":8.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 Pokémon are there in the third generation?
# 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 Pokémon are there in the third generation?
df.columns = ['number', 'name', 'type1', 'type2', 'total', 'hp', 'attack', 'defense', 'sp_attack', 'sp_defense', 'speed', 'generation', 'legendary']
# Expected output type: is number, this will be checked.
return | 20250129013715 |
27 | What is the average attack stat for all Pokémon? | 051_Pokemon | dev | number | ['attack'] | 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": "number",
"type": "uint16"
},
{
"name": "name",
"type": "category"
},
{
"name": "type1",
"type": "category"
},
{
"name": "type2",
"type": "category"
},
{
"name": "total",
"type": "uint16"
},
{
"name": "hp",
"type": "uint8"
},
{
"name": "attack",
"type": "uint8"
},
{
"name": "defense",
"type": "uint8"
},
{
"name": "sp_attack",
"type": "uint8"
},
{
"name": "sp_defense",
"type": "uint8"
},
{
"name": "speed",
"type": "uint8"
},
{
"name": "generation",
"type": "uint8"
},
{
"name": "legendary",
"type": "bool"
}
]
}
# Description of dataframe columns.
df_descrption = {
"count":{
"number":1072.0,
"total":1072.0,
"hp":1072.0,
"attack":1072.0,
"defense":1072.0,
"sp_attack":1072.0,
"sp_defense":1072.0,
"speed":1072.0,
"generation":1072.0
},
"mean":{
"number":445.2192164179,
"total":440.885261194,
"hp":70.4869402985,
"attack":80.9384328358,
"defense":74.9682835821,
"sp_attack":73.2733208955,
"sp_defense":72.4766791045,
"speed":68.7929104478,
"generation":4.2947761194
},
"std":{
"number":267.77280649,
"total":121.3790771926,
"hp":26.8680389923,
"attack":32.4635820748,
"defense":31.2080593873,
"sp_attack":32.6431190064,
"sp_defense":27.9342534926,
"speed":30.0762806451,
"generation":2.3464717631
},
"min":{
"number":1.0,
"total":175.0,
"hp":1.0,
"attack":5.0,
"defense":5.0,
"sp_attack":10.0,
"sp_defense":20.0,
"speed":5.0,
"generation":0.0
},
"25%":{
"number":209.75,
"total":330.0,
"hp":50.0,
"attack":56.0,
"defense":52.0,
"sp_attack":50.0,
"sp_defense":50.0,
"speed":45.0,
"generation":2.0
},
"50%":{
"number":442.5,
"total":460.5,
"hp":68.0,
"attack":80.0,
"defense":70.0,
"sp_attack":65.0,
"sp_defense":70.0,
"speed":65.0,
"generation":4.0
},
"75%":{
"number":681.25,
"total":519.25,
"hp":84.0,
"attack":100.0,
"defense":90.0,
"sp_attack":95.0,
"sp_defense":90.0,
"speed":90.0,
"generation":6.0
},
"max":{
"number":898.0,
"total":1125.0,
"hp":255.0,
"attack":190.0,
"defense":250.0,
"sp_attack":194.0,
"sp_defense":250.0,
"speed":200.0,
"generation":8.0
}
}
# Randome sample of 10 rows from the dataframe.
df_random_sample = {
"count":{
"number":1072.0,
"total":1072.0,
"hp":1072.0,
"attack":1072.0,
"defense":1072.0,
"sp_attack":1072.0,
"sp_defense":1072.0,
"speed":1072.0,
"generation":1072.0
},
"mean":{
"number":445.2192164179,
"total":440.885261194,
"hp":70.4869402985,
"attack":80.9384328358,
"defense":74.9682835821,
"sp_attack":73.2733208955,
"sp_defense":72.4766791045,
"speed":68.7929104478,
"generation":4.2947761194
},
"std":{
"number":267.77280649,
"total":121.3790771926,
"hp":26.8680389923,
"attack":32.4635820748,
"defense":31.2080593873,
"sp_attack":32.6431190064,
"sp_defense":27.9342534926,
"speed":30.0762806451,
"generation":2.3464717631
},
"min":{
"number":1.0,
"total":175.0,
"hp":1.0,
"attack":5.0,
"defense":5.0,
"sp_attack":10.0,
"sp_defense":20.0,
"speed":5.0,
"generation":0.0
},
"25%":{
"number":209.75,
"total":330.0,
"hp":50.0,
"attack":56.0,
"defense":52.0,
"sp_attack":50.0,
"sp_defense":50.0,
"speed":45.0,
"generation":2.0
},
"50%":{
"number":442.5,
"total":460.5,
"hp":68.0,
"attack":80.0,
"defense":70.0,
"sp_attack":65.0,
"sp_defense":70.0,
"speed":65.0,
"generation":4.0
},
"75%":{
"number":681.25,
"total":519.25,
"hp":84.0,
"attack":100.0,
"defense":90.0,
"sp_attack":95.0,
"sp_defense":90.0,
"speed":90.0,
"generation":6.0
},
"max":{
"number":898.0,
"total":1125.0,
"hp":255.0,
"attack":190.0,
"defense":250.0,
"sp_attack":194.0,
"sp_defense":250.0,
"speed":200.0,
"generation":8.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 attack stat for all Pokémon?
# 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 attack stat for all Pokémon?
df.columns = ['number', 'name', 'type1', 'type2', 'total', 'hp', 'attack', 'defense', 'sp_attack', 'sp_defense', 'speed', 'generation', 'legendary']
# Expected output type: is number, this will be checked.
return | 20250129013715 |
28 | What is the primary type of the Pokémon with the highest defense stat? | 051_Pokemon | dev | category | ['defense', 'type1'] | 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": "number",
"type": "uint16"
},
{
"name": "name",
"type": "category"
},
{
"name": "type1",
"type": "category"
},
{
"name": "type2",
"type": "category"
},
{
"name": "total",
"type": "uint16"
},
{
"name": "hp",
"type": "uint8"
},
{
"name": "attack",
"type": "uint8"
},
{
"name": "defense",
"type": "uint8"
},
{
"name": "sp_attack",
"type": "uint8"
},
{
"name": "sp_defense",
"type": "uint8"
},
{
"name": "speed",
"type": "uint8"
},
{
"name": "generation",
"type": "uint8"
},
{
"name": "legendary",
"type": "bool"
}
]
}
# Description of dataframe columns.
df_descrption = {
"count":{
"number":1072.0,
"total":1072.0,
"hp":1072.0,
"attack":1072.0,
"defense":1072.0,
"sp_attack":1072.0,
"sp_defense":1072.0,
"speed":1072.0,
"generation":1072.0
},
"mean":{
"number":445.2192164179,
"total":440.885261194,
"hp":70.4869402985,
"attack":80.9384328358,
"defense":74.9682835821,
"sp_attack":73.2733208955,
"sp_defense":72.4766791045,
"speed":68.7929104478,
"generation":4.2947761194
},
"std":{
"number":267.77280649,
"total":121.3790771926,
"hp":26.8680389923,
"attack":32.4635820748,
"defense":31.2080593873,
"sp_attack":32.6431190064,
"sp_defense":27.9342534926,
"speed":30.0762806451,
"generation":2.3464717631
},
"min":{
"number":1.0,
"total":175.0,
"hp":1.0,
"attack":5.0,
"defense":5.0,
"sp_attack":10.0,
"sp_defense":20.0,
"speed":5.0,
"generation":0.0
},
"25%":{
"number":209.75,
"total":330.0,
"hp":50.0,
"attack":56.0,
"defense":52.0,
"sp_attack":50.0,
"sp_defense":50.0,
"speed":45.0,
"generation":2.0
},
"50%":{
"number":442.5,
"total":460.5,
"hp":68.0,
"attack":80.0,
"defense":70.0,
"sp_attack":65.0,
"sp_defense":70.0,
"speed":65.0,
"generation":4.0
},
"75%":{
"number":681.25,
"total":519.25,
"hp":84.0,
"attack":100.0,
"defense":90.0,
"sp_attack":95.0,
"sp_defense":90.0,
"speed":90.0,
"generation":6.0
},
"max":{
"number":898.0,
"total":1125.0,
"hp":255.0,
"attack":190.0,
"defense":250.0,
"sp_attack":194.0,
"sp_defense":250.0,
"speed":200.0,
"generation":8.0
}
}
# Randome sample of 10 rows from the dataframe.
df_random_sample = {
"count":{
"number":1072.0,
"total":1072.0,
"hp":1072.0,
"attack":1072.0,
"defense":1072.0,
"sp_attack":1072.0,
"sp_defense":1072.0,
"speed":1072.0,
"generation":1072.0
},
"mean":{
"number":445.2192164179,
"total":440.885261194,
"hp":70.4869402985,
"attack":80.9384328358,
"defense":74.9682835821,
"sp_attack":73.2733208955,
"sp_defense":72.4766791045,
"speed":68.7929104478,
"generation":4.2947761194
},
"std":{
"number":267.77280649,
"total":121.3790771926,
"hp":26.8680389923,
"attack":32.4635820748,
"defense":31.2080593873,
"sp_attack":32.6431190064,
"sp_defense":27.9342534926,
"speed":30.0762806451,
"generation":2.3464717631
},
"min":{
"number":1.0,
"total":175.0,
"hp":1.0,
"attack":5.0,
"defense":5.0,
"sp_attack":10.0,
"sp_defense":20.0,
"speed":5.0,
"generation":0.0
},
"25%":{
"number":209.75,
"total":330.0,
"hp":50.0,
"attack":56.0,
"defense":52.0,
"sp_attack":50.0,
"sp_defense":50.0,
"speed":45.0,
"generation":2.0
},
"50%":{
"number":442.5,
"total":460.5,
"hp":68.0,
"attack":80.0,
"defense":70.0,
"sp_attack":65.0,
"sp_defense":70.0,
"speed":65.0,
"generation":4.0
},
"75%":{
"number":681.25,
"total":519.25,
"hp":84.0,
"attack":100.0,
"defense":90.0,
"sp_attack":95.0,
"sp_defense":90.0,
"speed":90.0,
"generation":6.0
},
"max":{
"number":898.0,
"total":1125.0,
"hp":255.0,
"attack":190.0,
"defense":250.0,
"sp_attack":194.0,
"sp_defense":250.0,
"speed":200.0,
"generation":8.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 primary type of the Pokémon with the highest defense stat?
# 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 primary type of the Pokémon with the highest defense stat?
df.columns = ['number', 'name', 'type1', 'type2', 'total', 'hp', 'attack', 'defense', 'sp_attack', 'sp_defense', 'speed', 'generation', 'legendary']
# Expected output type: is category, this will be checked.
return | 20250129013715 |
29 | Which Pokémon has the lowest speed stat? | 051_Pokemon | dev | category | ['speed', '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": "number",
"type": "uint16"
},
{
"name": "name",
"type": "category"
},
{
"name": "type1",
"type": "category"
},
{
"name": "type2",
"type": "category"
},
{
"name": "total",
"type": "uint16"
},
{
"name": "hp",
"type": "uint8"
},
{
"name": "attack",
"type": "uint8"
},
{
"name": "defense",
"type": "uint8"
},
{
"name": "sp_attack",
"type": "uint8"
},
{
"name": "sp_defense",
"type": "uint8"
},
{
"name": "speed",
"type": "uint8"
},
{
"name": "generation",
"type": "uint8"
},
{
"name": "legendary",
"type": "bool"
}
]
}
# Description of dataframe columns.
df_descrption = {
"count":{
"number":1072.0,
"total":1072.0,
"hp":1072.0,
"attack":1072.0,
"defense":1072.0,
"sp_attack":1072.0,
"sp_defense":1072.0,
"speed":1072.0,
"generation":1072.0
},
"mean":{
"number":445.2192164179,
"total":440.885261194,
"hp":70.4869402985,
"attack":80.9384328358,
"defense":74.9682835821,
"sp_attack":73.2733208955,
"sp_defense":72.4766791045,
"speed":68.7929104478,
"generation":4.2947761194
},
"std":{
"number":267.77280649,
"total":121.3790771926,
"hp":26.8680389923,
"attack":32.4635820748,
"defense":31.2080593873,
"sp_attack":32.6431190064,
"sp_defense":27.9342534926,
"speed":30.0762806451,
"generation":2.3464717631
},
"min":{
"number":1.0,
"total":175.0,
"hp":1.0,
"attack":5.0,
"defense":5.0,
"sp_attack":10.0,
"sp_defense":20.0,
"speed":5.0,
"generation":0.0
},
"25%":{
"number":209.75,
"total":330.0,
"hp":50.0,
"attack":56.0,
"defense":52.0,
"sp_attack":50.0,
"sp_defense":50.0,
"speed":45.0,
"generation":2.0
},
"50%":{
"number":442.5,
"total":460.5,
"hp":68.0,
"attack":80.0,
"defense":70.0,
"sp_attack":65.0,
"sp_defense":70.0,
"speed":65.0,
"generation":4.0
},
"75%":{
"number":681.25,
"total":519.25,
"hp":84.0,
"attack":100.0,
"defense":90.0,
"sp_attack":95.0,
"sp_defense":90.0,
"speed":90.0,
"generation":6.0
},
"max":{
"number":898.0,
"total":1125.0,
"hp":255.0,
"attack":190.0,
"defense":250.0,
"sp_attack":194.0,
"sp_defense":250.0,
"speed":200.0,
"generation":8.0
}
}
# Randome sample of 10 rows from the dataframe.
df_random_sample = {
"count":{
"number":1072.0,
"total":1072.0,
"hp":1072.0,
"attack":1072.0,
"defense":1072.0,
"sp_attack":1072.0,
"sp_defense":1072.0,
"speed":1072.0,
"generation":1072.0
},
"mean":{
"number":445.2192164179,
"total":440.885261194,
"hp":70.4869402985,
"attack":80.9384328358,
"defense":74.9682835821,
"sp_attack":73.2733208955,
"sp_defense":72.4766791045,
"speed":68.7929104478,
"generation":4.2947761194
},
"std":{
"number":267.77280649,
"total":121.3790771926,
"hp":26.8680389923,
"attack":32.4635820748,
"defense":31.2080593873,
"sp_attack":32.6431190064,
"sp_defense":27.9342534926,
"speed":30.0762806451,
"generation":2.3464717631
},
"min":{
"number":1.0,
"total":175.0,
"hp":1.0,
"attack":5.0,
"defense":5.0,
"sp_attack":10.0,
"sp_defense":20.0,
"speed":5.0,
"generation":0.0
},
"25%":{
"number":209.75,
"total":330.0,
"hp":50.0,
"attack":56.0,
"defense":52.0,
"sp_attack":50.0,
"sp_defense":50.0,
"speed":45.0,
"generation":2.0
},
"50%":{
"number":442.5,
"total":460.5,
"hp":68.0,
"attack":80.0,
"defense":70.0,
"sp_attack":65.0,
"sp_defense":70.0,
"speed":65.0,
"generation":4.0
},
"75%":{
"number":681.25,
"total":519.25,
"hp":84.0,
"attack":100.0,
"defense":90.0,
"sp_attack":95.0,
"sp_defense":90.0,
"speed":90.0,
"generation":6.0
},
"max":{
"number":898.0,
"total":1125.0,
"hp":255.0,
"attack":190.0,
"defense":250.0,
"sp_attack":194.0,
"sp_defense":250.0,
"speed":200.0,
"generation":8.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 Pokémon has the lowest speed stat?
# 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 Pokémon has the lowest speed stat?
df.columns = ['number', 'name', 'type1', 'type2', 'total', 'hp', 'attack', 'defense', 'sp_attack', 'sp_defense', 'speed', 'generation', 'legendary']
# Expected output type: is category, this will be checked.
return | 20250129013715 |
30 | What primary type is the most common among legendary Pokémon? | 051_Pokemon | dev | category | ['legendary', 'type1'] | 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": "number",
"type": "uint16"
},
{
"name": "name",
"type": "category"
},
{
"name": "type1",
"type": "category"
},
{
"name": "type2",
"type": "category"
},
{
"name": "total",
"type": "uint16"
},
{
"name": "hp",
"type": "uint8"
},
{
"name": "attack",
"type": "uint8"
},
{
"name": "defense",
"type": "uint8"
},
{
"name": "sp_attack",
"type": "uint8"
},
{
"name": "sp_defense",
"type": "uint8"
},
{
"name": "speed",
"type": "uint8"
},
{
"name": "generation",
"type": "uint8"
},
{
"name": "legendary",
"type": "bool"
}
]
}
# Description of dataframe columns.
df_descrption = {
"count":{
"number":1072.0,
"total":1072.0,
"hp":1072.0,
"attack":1072.0,
"defense":1072.0,
"sp_attack":1072.0,
"sp_defense":1072.0,
"speed":1072.0,
"generation":1072.0
},
"mean":{
"number":445.2192164179,
"total":440.885261194,
"hp":70.4869402985,
"attack":80.9384328358,
"defense":74.9682835821,
"sp_attack":73.2733208955,
"sp_defense":72.4766791045,
"speed":68.7929104478,
"generation":4.2947761194
},
"std":{
"number":267.77280649,
"total":121.3790771926,
"hp":26.8680389923,
"attack":32.4635820748,
"defense":31.2080593873,
"sp_attack":32.6431190064,
"sp_defense":27.9342534926,
"speed":30.0762806451,
"generation":2.3464717631
},
"min":{
"number":1.0,
"total":175.0,
"hp":1.0,
"attack":5.0,
"defense":5.0,
"sp_attack":10.0,
"sp_defense":20.0,
"speed":5.0,
"generation":0.0
},
"25%":{
"number":209.75,
"total":330.0,
"hp":50.0,
"attack":56.0,
"defense":52.0,
"sp_attack":50.0,
"sp_defense":50.0,
"speed":45.0,
"generation":2.0
},
"50%":{
"number":442.5,
"total":460.5,
"hp":68.0,
"attack":80.0,
"defense":70.0,
"sp_attack":65.0,
"sp_defense":70.0,
"speed":65.0,
"generation":4.0
},
"75%":{
"number":681.25,
"total":519.25,
"hp":84.0,
"attack":100.0,
"defense":90.0,
"sp_attack":95.0,
"sp_defense":90.0,
"speed":90.0,
"generation":6.0
},
"max":{
"number":898.0,
"total":1125.0,
"hp":255.0,
"attack":190.0,
"defense":250.0,
"sp_attack":194.0,
"sp_defense":250.0,
"speed":200.0,
"generation":8.0
}
}
# Randome sample of 10 rows from the dataframe.
df_random_sample = {
"count":{
"number":1072.0,
"total":1072.0,
"hp":1072.0,
"attack":1072.0,
"defense":1072.0,
"sp_attack":1072.0,
"sp_defense":1072.0,
"speed":1072.0,
"generation":1072.0
},
"mean":{
"number":445.2192164179,
"total":440.885261194,
"hp":70.4869402985,
"attack":80.9384328358,
"defense":74.9682835821,
"sp_attack":73.2733208955,
"sp_defense":72.4766791045,
"speed":68.7929104478,
"generation":4.2947761194
},
"std":{
"number":267.77280649,
"total":121.3790771926,
"hp":26.8680389923,
"attack":32.4635820748,
"defense":31.2080593873,
"sp_attack":32.6431190064,
"sp_defense":27.9342534926,
"speed":30.0762806451,
"generation":2.3464717631
},
"min":{
"number":1.0,
"total":175.0,
"hp":1.0,
"attack":5.0,
"defense":5.0,
"sp_attack":10.0,
"sp_defense":20.0,
"speed":5.0,
"generation":0.0
},
"25%":{
"number":209.75,
"total":330.0,
"hp":50.0,
"attack":56.0,
"defense":52.0,
"sp_attack":50.0,
"sp_defense":50.0,
"speed":45.0,
"generation":2.0
},
"50%":{
"number":442.5,
"total":460.5,
"hp":68.0,
"attack":80.0,
"defense":70.0,
"sp_attack":65.0,
"sp_defense":70.0,
"speed":65.0,
"generation":4.0
},
"75%":{
"number":681.25,
"total":519.25,
"hp":84.0,
"attack":100.0,
"defense":90.0,
"sp_attack":95.0,
"sp_defense":90.0,
"speed":90.0,
"generation":6.0
},
"max":{
"number":898.0,
"total":1125.0,
"hp":255.0,
"attack":190.0,
"defense":250.0,
"sp_attack":194.0,
"sp_defense":250.0,
"speed":200.0,
"generation":8.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 primary type is the most common among legendary Pokémon?
# 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 primary type is the most common among legendary Pokémon?
df.columns = ['number', 'name', 'type1', 'type2', 'total', 'hp', 'attack', 'defense', 'sp_attack', 'sp_defense', 'speed', 'generation', 'legendary']
# Expected output type: is category, this will be checked.
return | 20250129013715 |
31 | Which Pokémon has the highest special attack? | 051_Pokemon | dev | category | ['sp_attack', '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": "number",
"type": "uint16"
},
{
"name": "name",
"type": "category"
},
{
"name": "type1",
"type": "category"
},
{
"name": "type2",
"type": "category"
},
{
"name": "total",
"type": "uint16"
},
{
"name": "hp",
"type": "uint8"
},
{
"name": "attack",
"type": "uint8"
},
{
"name": "defense",
"type": "uint8"
},
{
"name": "sp_attack",
"type": "uint8"
},
{
"name": "sp_defense",
"type": "uint8"
},
{
"name": "speed",
"type": "uint8"
},
{
"name": "generation",
"type": "uint8"
},
{
"name": "legendary",
"type": "bool"
}
]
}
# Description of dataframe columns.
df_descrption = {
"count":{
"number":1072.0,
"total":1072.0,
"hp":1072.0,
"attack":1072.0,
"defense":1072.0,
"sp_attack":1072.0,
"sp_defense":1072.0,
"speed":1072.0,
"generation":1072.0
},
"mean":{
"number":445.2192164179,
"total":440.885261194,
"hp":70.4869402985,
"attack":80.9384328358,
"defense":74.9682835821,
"sp_attack":73.2733208955,
"sp_defense":72.4766791045,
"speed":68.7929104478,
"generation":4.2947761194
},
"std":{
"number":267.77280649,
"total":121.3790771926,
"hp":26.8680389923,
"attack":32.4635820748,
"defense":31.2080593873,
"sp_attack":32.6431190064,
"sp_defense":27.9342534926,
"speed":30.0762806451,
"generation":2.3464717631
},
"min":{
"number":1.0,
"total":175.0,
"hp":1.0,
"attack":5.0,
"defense":5.0,
"sp_attack":10.0,
"sp_defense":20.0,
"speed":5.0,
"generation":0.0
},
"25%":{
"number":209.75,
"total":330.0,
"hp":50.0,
"attack":56.0,
"defense":52.0,
"sp_attack":50.0,
"sp_defense":50.0,
"speed":45.0,
"generation":2.0
},
"50%":{
"number":442.5,
"total":460.5,
"hp":68.0,
"attack":80.0,
"defense":70.0,
"sp_attack":65.0,
"sp_defense":70.0,
"speed":65.0,
"generation":4.0
},
"75%":{
"number":681.25,
"total":519.25,
"hp":84.0,
"attack":100.0,
"defense":90.0,
"sp_attack":95.0,
"sp_defense":90.0,
"speed":90.0,
"generation":6.0
},
"max":{
"number":898.0,
"total":1125.0,
"hp":255.0,
"attack":190.0,
"defense":250.0,
"sp_attack":194.0,
"sp_defense":250.0,
"speed":200.0,
"generation":8.0
}
}
# Randome sample of 10 rows from the dataframe.
df_random_sample = {
"count":{
"number":1072.0,
"total":1072.0,
"hp":1072.0,
"attack":1072.0,
"defense":1072.0,
"sp_attack":1072.0,
"sp_defense":1072.0,
"speed":1072.0,
"generation":1072.0
},
"mean":{
"number":445.2192164179,
"total":440.885261194,
"hp":70.4869402985,
"attack":80.9384328358,
"defense":74.9682835821,
"sp_attack":73.2733208955,
"sp_defense":72.4766791045,
"speed":68.7929104478,
"generation":4.2947761194
},
"std":{
"number":267.77280649,
"total":121.3790771926,
"hp":26.8680389923,
"attack":32.4635820748,
"defense":31.2080593873,
"sp_attack":32.6431190064,
"sp_defense":27.9342534926,
"speed":30.0762806451,
"generation":2.3464717631
},
"min":{
"number":1.0,
"total":175.0,
"hp":1.0,
"attack":5.0,
"defense":5.0,
"sp_attack":10.0,
"sp_defense":20.0,
"speed":5.0,
"generation":0.0
},
"25%":{
"number":209.75,
"total":330.0,
"hp":50.0,
"attack":56.0,
"defense":52.0,
"sp_attack":50.0,
"sp_defense":50.0,
"speed":45.0,
"generation":2.0
},
"50%":{
"number":442.5,
"total":460.5,
"hp":68.0,
"attack":80.0,
"defense":70.0,
"sp_attack":65.0,
"sp_defense":70.0,
"speed":65.0,
"generation":4.0
},
"75%":{
"number":681.25,
"total":519.25,
"hp":84.0,
"attack":100.0,
"defense":90.0,
"sp_attack":95.0,
"sp_defense":90.0,
"speed":90.0,
"generation":6.0
},
"max":{
"number":898.0,
"total":1125.0,
"hp":255.0,
"attack":190.0,
"defense":250.0,
"sp_attack":194.0,
"sp_defense":250.0,
"speed":200.0,
"generation":8.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 Pokémon has the highest special attack?
# 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 Pokémon has the highest special attack?
df.columns = ['number', 'name', 'type1', 'type2', 'total', 'hp', 'attack', 'defense', 'sp_attack', 'sp_defense', 'speed', 'generation', 'legendary']
# Expected output type: is category, this will be checked.
return | 20250129013715 |
32 | Name the top 3 Pokémon with the highest total stats. | 051_Pokemon | dev | list[category] | ['total', '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": "number",
"type": "uint16"
},
{
"name": "name",
"type": "category"
},
{
"name": "type1",
"type": "category"
},
{
"name": "type2",
"type": "category"
},
{
"name": "total",
"type": "uint16"
},
{
"name": "hp",
"type": "uint8"
},
{
"name": "attack",
"type": "uint8"
},
{
"name": "defense",
"type": "uint8"
},
{
"name": "sp_attack",
"type": "uint8"
},
{
"name": "sp_defense",
"type": "uint8"
},
{
"name": "speed",
"type": "uint8"
},
{
"name": "generation",
"type": "uint8"
},
{
"name": "legendary",
"type": "bool"
}
]
}
# Description of dataframe columns.
df_descrption = {
"count":{
"number":1072.0,
"total":1072.0,
"hp":1072.0,
"attack":1072.0,
"defense":1072.0,
"sp_attack":1072.0,
"sp_defense":1072.0,
"speed":1072.0,
"generation":1072.0
},
"mean":{
"number":445.2192164179,
"total":440.885261194,
"hp":70.4869402985,
"attack":80.9384328358,
"defense":74.9682835821,
"sp_attack":73.2733208955,
"sp_defense":72.4766791045,
"speed":68.7929104478,
"generation":4.2947761194
},
"std":{
"number":267.77280649,
"total":121.3790771926,
"hp":26.8680389923,
"attack":32.4635820748,
"defense":31.2080593873,
"sp_attack":32.6431190064,
"sp_defense":27.9342534926,
"speed":30.0762806451,
"generation":2.3464717631
},
"min":{
"number":1.0,
"total":175.0,
"hp":1.0,
"attack":5.0,
"defense":5.0,
"sp_attack":10.0,
"sp_defense":20.0,
"speed":5.0,
"generation":0.0
},
"25%":{
"number":209.75,
"total":330.0,
"hp":50.0,
"attack":56.0,
"defense":52.0,
"sp_attack":50.0,
"sp_defense":50.0,
"speed":45.0,
"generation":2.0
},
"50%":{
"number":442.5,
"total":460.5,
"hp":68.0,
"attack":80.0,
"defense":70.0,
"sp_attack":65.0,
"sp_defense":70.0,
"speed":65.0,
"generation":4.0
},
"75%":{
"number":681.25,
"total":519.25,
"hp":84.0,
"attack":100.0,
"defense":90.0,
"sp_attack":95.0,
"sp_defense":90.0,
"speed":90.0,
"generation":6.0
},
"max":{
"number":898.0,
"total":1125.0,
"hp":255.0,
"attack":190.0,
"defense":250.0,
"sp_attack":194.0,
"sp_defense":250.0,
"speed":200.0,
"generation":8.0
}
}
# Randome sample of 10 rows from the dataframe.
df_random_sample = {
"count":{
"number":1072.0,
"total":1072.0,
"hp":1072.0,
"attack":1072.0,
"defense":1072.0,
"sp_attack":1072.0,
"sp_defense":1072.0,
"speed":1072.0,
"generation":1072.0
},
"mean":{
"number":445.2192164179,
"total":440.885261194,
"hp":70.4869402985,
"attack":80.9384328358,
"defense":74.9682835821,
"sp_attack":73.2733208955,
"sp_defense":72.4766791045,
"speed":68.7929104478,
"generation":4.2947761194
},
"std":{
"number":267.77280649,
"total":121.3790771926,
"hp":26.8680389923,
"attack":32.4635820748,
"defense":31.2080593873,
"sp_attack":32.6431190064,
"sp_defense":27.9342534926,
"speed":30.0762806451,
"generation":2.3464717631
},
"min":{
"number":1.0,
"total":175.0,
"hp":1.0,
"attack":5.0,
"defense":5.0,
"sp_attack":10.0,
"sp_defense":20.0,
"speed":5.0,
"generation":0.0
},
"25%":{
"number":209.75,
"total":330.0,
"hp":50.0,
"attack":56.0,
"defense":52.0,
"sp_attack":50.0,
"sp_defense":50.0,
"speed":45.0,
"generation":2.0
},
"50%":{
"number":442.5,
"total":460.5,
"hp":68.0,
"attack":80.0,
"defense":70.0,
"sp_attack":65.0,
"sp_defense":70.0,
"speed":65.0,
"generation":4.0
},
"75%":{
"number":681.25,
"total":519.25,
"hp":84.0,
"attack":100.0,
"defense":90.0,
"sp_attack":95.0,
"sp_defense":90.0,
"speed":90.0,
"generation":6.0
},
"max":{
"number":898.0,
"total":1125.0,
"hp":255.0,
"attack":190.0,
"defense":250.0,
"sp_attack":194.0,
"sp_defense":250.0,
"speed":200.0,
"generation":8.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 3 Pokémon with the highest total stats.
# 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 3 Pokémon with the highest total stats.
df.columns = ['number', 'name', 'type1', 'type2', 'total', 'hp', 'attack', 'defense', 'sp_attack', 'sp_defense', 'speed', 'generation', 'legendary']
# Expected output type: is list[category], this will be checked.
return | 20250129013715 |
33 | Which 5 Pokémon have the lowest hp stats? | 051_Pokemon | dev | list[category] | ['hp', '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": "number",
"type": "uint16"
},
{
"name": "name",
"type": "category"
},
{
"name": "type1",
"type": "category"
},
{
"name": "type2",
"type": "category"
},
{
"name": "total",
"type": "uint16"
},
{
"name": "hp",
"type": "uint8"
},
{
"name": "attack",
"type": "uint8"
},
{
"name": "defense",
"type": "uint8"
},
{
"name": "sp_attack",
"type": "uint8"
},
{
"name": "sp_defense",
"type": "uint8"
},
{
"name": "speed",
"type": "uint8"
},
{
"name": "generation",
"type": "uint8"
},
{
"name": "legendary",
"type": "bool"
}
]
}
# Description of dataframe columns.
df_descrption = {
"count":{
"number":1072.0,
"total":1072.0,
"hp":1072.0,
"attack":1072.0,
"defense":1072.0,
"sp_attack":1072.0,
"sp_defense":1072.0,
"speed":1072.0,
"generation":1072.0
},
"mean":{
"number":445.2192164179,
"total":440.885261194,
"hp":70.4869402985,
"attack":80.9384328358,
"defense":74.9682835821,
"sp_attack":73.2733208955,
"sp_defense":72.4766791045,
"speed":68.7929104478,
"generation":4.2947761194
},
"std":{
"number":267.77280649,
"total":121.3790771926,
"hp":26.8680389923,
"attack":32.4635820748,
"defense":31.2080593873,
"sp_attack":32.6431190064,
"sp_defense":27.9342534926,
"speed":30.0762806451,
"generation":2.3464717631
},
"min":{
"number":1.0,
"total":175.0,
"hp":1.0,
"attack":5.0,
"defense":5.0,
"sp_attack":10.0,
"sp_defense":20.0,
"speed":5.0,
"generation":0.0
},
"25%":{
"number":209.75,
"total":330.0,
"hp":50.0,
"attack":56.0,
"defense":52.0,
"sp_attack":50.0,
"sp_defense":50.0,
"speed":45.0,
"generation":2.0
},
"50%":{
"number":442.5,
"total":460.5,
"hp":68.0,
"attack":80.0,
"defense":70.0,
"sp_attack":65.0,
"sp_defense":70.0,
"speed":65.0,
"generation":4.0
},
"75%":{
"number":681.25,
"total":519.25,
"hp":84.0,
"attack":100.0,
"defense":90.0,
"sp_attack":95.0,
"sp_defense":90.0,
"speed":90.0,
"generation":6.0
},
"max":{
"number":898.0,
"total":1125.0,
"hp":255.0,
"attack":190.0,
"defense":250.0,
"sp_attack":194.0,
"sp_defense":250.0,
"speed":200.0,
"generation":8.0
}
}
# Randome sample of 10 rows from the dataframe.
df_random_sample = {
"count":{
"number":1072.0,
"total":1072.0,
"hp":1072.0,
"attack":1072.0,
"defense":1072.0,
"sp_attack":1072.0,
"sp_defense":1072.0,
"speed":1072.0,
"generation":1072.0
},
"mean":{
"number":445.2192164179,
"total":440.885261194,
"hp":70.4869402985,
"attack":80.9384328358,
"defense":74.9682835821,
"sp_attack":73.2733208955,
"sp_defense":72.4766791045,
"speed":68.7929104478,
"generation":4.2947761194
},
"std":{
"number":267.77280649,
"total":121.3790771926,
"hp":26.8680389923,
"attack":32.4635820748,
"defense":31.2080593873,
"sp_attack":32.6431190064,
"sp_defense":27.9342534926,
"speed":30.0762806451,
"generation":2.3464717631
},
"min":{
"number":1.0,
"total":175.0,
"hp":1.0,
"attack":5.0,
"defense":5.0,
"sp_attack":10.0,
"sp_defense":20.0,
"speed":5.0,
"generation":0.0
},
"25%":{
"number":209.75,
"total":330.0,
"hp":50.0,
"attack":56.0,
"defense":52.0,
"sp_attack":50.0,
"sp_defense":50.0,
"speed":45.0,
"generation":2.0
},
"50%":{
"number":442.5,
"total":460.5,
"hp":68.0,
"attack":80.0,
"defense":70.0,
"sp_attack":65.0,
"sp_defense":70.0,
"speed":65.0,
"generation":4.0
},
"75%":{
"number":681.25,
"total":519.25,
"hp":84.0,
"attack":100.0,
"defense":90.0,
"sp_attack":95.0,
"sp_defense":90.0,
"speed":90.0,
"generation":6.0
},
"max":{
"number":898.0,
"total":1125.0,
"hp":255.0,
"attack":190.0,
"defense":250.0,
"sp_attack":194.0,
"sp_defense":250.0,
"speed":200.0,
"generation":8.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 5 Pokémon have the lowest hp stats?
# 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 5 Pokémon have the lowest hp stats?
df.columns = ['number', 'name', 'type1', 'type2', 'total', 'hp', 'attack', 'defense', 'sp_attack', 'sp_defense', 'speed', 'generation', 'legendary']
# Expected output type: is list[category], this will be checked.
return | 20250129013715 |
34 | Name the top 2 primary categories that have the most Pokémon. | 051_Pokemon | dev | list[category] | ['type1'] | 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": "number",
"type": "uint16"
},
{
"name": "name",
"type": "category"
},
{
"name": "type1",
"type": "category"
},
{
"name": "type2",
"type": "category"
},
{
"name": "total",
"type": "uint16"
},
{
"name": "hp",
"type": "uint8"
},
{
"name": "attack",
"type": "uint8"
},
{
"name": "defense",
"type": "uint8"
},
{
"name": "sp_attack",
"type": "uint8"
},
{
"name": "sp_defense",
"type": "uint8"
},
{
"name": "speed",
"type": "uint8"
},
{
"name": "generation",
"type": "uint8"
},
{
"name": "legendary",
"type": "bool"
}
]
}
# Description of dataframe columns.
df_descrption = {
"count":{
"number":1072.0,
"total":1072.0,
"hp":1072.0,
"attack":1072.0,
"defense":1072.0,
"sp_attack":1072.0,
"sp_defense":1072.0,
"speed":1072.0,
"generation":1072.0
},
"mean":{
"number":445.2192164179,
"total":440.885261194,
"hp":70.4869402985,
"attack":80.9384328358,
"defense":74.9682835821,
"sp_attack":73.2733208955,
"sp_defense":72.4766791045,
"speed":68.7929104478,
"generation":4.2947761194
},
"std":{
"number":267.77280649,
"total":121.3790771926,
"hp":26.8680389923,
"attack":32.4635820748,
"defense":31.2080593873,
"sp_attack":32.6431190064,
"sp_defense":27.9342534926,
"speed":30.0762806451,
"generation":2.3464717631
},
"min":{
"number":1.0,
"total":175.0,
"hp":1.0,
"attack":5.0,
"defense":5.0,
"sp_attack":10.0,
"sp_defense":20.0,
"speed":5.0,
"generation":0.0
},
"25%":{
"number":209.75,
"total":330.0,
"hp":50.0,
"attack":56.0,
"defense":52.0,
"sp_attack":50.0,
"sp_defense":50.0,
"speed":45.0,
"generation":2.0
},
"50%":{
"number":442.5,
"total":460.5,
"hp":68.0,
"attack":80.0,
"defense":70.0,
"sp_attack":65.0,
"sp_defense":70.0,
"speed":65.0,
"generation":4.0
},
"75%":{
"number":681.25,
"total":519.25,
"hp":84.0,
"attack":100.0,
"defense":90.0,
"sp_attack":95.0,
"sp_defense":90.0,
"speed":90.0,
"generation":6.0
},
"max":{
"number":898.0,
"total":1125.0,
"hp":255.0,
"attack":190.0,
"defense":250.0,
"sp_attack":194.0,
"sp_defense":250.0,
"speed":200.0,
"generation":8.0
}
}
# Randome sample of 10 rows from the dataframe.
df_random_sample = {
"count":{
"number":1072.0,
"total":1072.0,
"hp":1072.0,
"attack":1072.0,
"defense":1072.0,
"sp_attack":1072.0,
"sp_defense":1072.0,
"speed":1072.0,
"generation":1072.0
},
"mean":{
"number":445.2192164179,
"total":440.885261194,
"hp":70.4869402985,
"attack":80.9384328358,
"defense":74.9682835821,
"sp_attack":73.2733208955,
"sp_defense":72.4766791045,
"speed":68.7929104478,
"generation":4.2947761194
},
"std":{
"number":267.77280649,
"total":121.3790771926,
"hp":26.8680389923,
"attack":32.4635820748,
"defense":31.2080593873,
"sp_attack":32.6431190064,
"sp_defense":27.9342534926,
"speed":30.0762806451,
"generation":2.3464717631
},
"min":{
"number":1.0,
"total":175.0,
"hp":1.0,
"attack":5.0,
"defense":5.0,
"sp_attack":10.0,
"sp_defense":20.0,
"speed":5.0,
"generation":0.0
},
"25%":{
"number":209.75,
"total":330.0,
"hp":50.0,
"attack":56.0,
"defense":52.0,
"sp_attack":50.0,
"sp_defense":50.0,
"speed":45.0,
"generation":2.0
},
"50%":{
"number":442.5,
"total":460.5,
"hp":68.0,
"attack":80.0,
"defense":70.0,
"sp_attack":65.0,
"sp_defense":70.0,
"speed":65.0,
"generation":4.0
},
"75%":{
"number":681.25,
"total":519.25,
"hp":84.0,
"attack":100.0,
"defense":90.0,
"sp_attack":95.0,
"sp_defense":90.0,
"speed":90.0,
"generation":6.0
},
"max":{
"number":898.0,
"total":1125.0,
"hp":255.0,
"attack":190.0,
"defense":250.0,
"sp_attack":194.0,
"sp_defense":250.0,
"speed":200.0,
"generation":8.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 primary categories that have the most Pokémon.
# 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 primary categories that have the most Pokémon.
df.columns = ['number', 'name', 'type1', 'type2', 'total', 'hp', 'attack', 'defense', 'sp_attack', 'sp_defense', 'speed', 'generation', 'legendary']
# Expected output type: is list[category], this will be checked.
return | 20250129013715 |
35 | Which 6 Pokémon from the second generation have the highest attack stats? | 051_Pokemon | dev | list[category] | ['generation', 'attack', '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": "number",
"type": "uint16"
},
{
"name": "name",
"type": "category"
},
{
"name": "type1",
"type": "category"
},
{
"name": "type2",
"type": "category"
},
{
"name": "total",
"type": "uint16"
},
{
"name": "hp",
"type": "uint8"
},
{
"name": "attack",
"type": "uint8"
},
{
"name": "defense",
"type": "uint8"
},
{
"name": "sp_attack",
"type": "uint8"
},
{
"name": "sp_defense",
"type": "uint8"
},
{
"name": "speed",
"type": "uint8"
},
{
"name": "generation",
"type": "uint8"
},
{
"name": "legendary",
"type": "bool"
}
]
}
# Description of dataframe columns.
df_descrption = {
"count":{
"number":1072.0,
"total":1072.0,
"hp":1072.0,
"attack":1072.0,
"defense":1072.0,
"sp_attack":1072.0,
"sp_defense":1072.0,
"speed":1072.0,
"generation":1072.0
},
"mean":{
"number":445.2192164179,
"total":440.885261194,
"hp":70.4869402985,
"attack":80.9384328358,
"defense":74.9682835821,
"sp_attack":73.2733208955,
"sp_defense":72.4766791045,
"speed":68.7929104478,
"generation":4.2947761194
},
"std":{
"number":267.77280649,
"total":121.3790771926,
"hp":26.8680389923,
"attack":32.4635820748,
"defense":31.2080593873,
"sp_attack":32.6431190064,
"sp_defense":27.9342534926,
"speed":30.0762806451,
"generation":2.3464717631
},
"min":{
"number":1.0,
"total":175.0,
"hp":1.0,
"attack":5.0,
"defense":5.0,
"sp_attack":10.0,
"sp_defense":20.0,
"speed":5.0,
"generation":0.0
},
"25%":{
"number":209.75,
"total":330.0,
"hp":50.0,
"attack":56.0,
"defense":52.0,
"sp_attack":50.0,
"sp_defense":50.0,
"speed":45.0,
"generation":2.0
},
"50%":{
"number":442.5,
"total":460.5,
"hp":68.0,
"attack":80.0,
"defense":70.0,
"sp_attack":65.0,
"sp_defense":70.0,
"speed":65.0,
"generation":4.0
},
"75%":{
"number":681.25,
"total":519.25,
"hp":84.0,
"attack":100.0,
"defense":90.0,
"sp_attack":95.0,
"sp_defense":90.0,
"speed":90.0,
"generation":6.0
},
"max":{
"number":898.0,
"total":1125.0,
"hp":255.0,
"attack":190.0,
"defense":250.0,
"sp_attack":194.0,
"sp_defense":250.0,
"speed":200.0,
"generation":8.0
}
}
# Randome sample of 10 rows from the dataframe.
df_random_sample = {
"count":{
"number":1072.0,
"total":1072.0,
"hp":1072.0,
"attack":1072.0,
"defense":1072.0,
"sp_attack":1072.0,
"sp_defense":1072.0,
"speed":1072.0,
"generation":1072.0
},
"mean":{
"number":445.2192164179,
"total":440.885261194,
"hp":70.4869402985,
"attack":80.9384328358,
"defense":74.9682835821,
"sp_attack":73.2733208955,
"sp_defense":72.4766791045,
"speed":68.7929104478,
"generation":4.2947761194
},
"std":{
"number":267.77280649,
"total":121.3790771926,
"hp":26.8680389923,
"attack":32.4635820748,
"defense":31.2080593873,
"sp_attack":32.6431190064,
"sp_defense":27.9342534926,
"speed":30.0762806451,
"generation":2.3464717631
},
"min":{
"number":1.0,
"total":175.0,
"hp":1.0,
"attack":5.0,
"defense":5.0,
"sp_attack":10.0,
"sp_defense":20.0,
"speed":5.0,
"generation":0.0
},
"25%":{
"number":209.75,
"total":330.0,
"hp":50.0,
"attack":56.0,
"defense":52.0,
"sp_attack":50.0,
"sp_defense":50.0,
"speed":45.0,
"generation":2.0
},
"50%":{
"number":442.5,
"total":460.5,
"hp":68.0,
"attack":80.0,
"defense":70.0,
"sp_attack":65.0,
"sp_defense":70.0,
"speed":65.0,
"generation":4.0
},
"75%":{
"number":681.25,
"total":519.25,
"hp":84.0,
"attack":100.0,
"defense":90.0,
"sp_attack":95.0,
"sp_defense":90.0,
"speed":90.0,
"generation":6.0
},
"max":{
"number":898.0,
"total":1125.0,
"hp":255.0,
"attack":190.0,
"defense":250.0,
"sp_attack":194.0,
"sp_defense":250.0,
"speed":200.0,
"generation":8.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 6 Pokémon from the second generation have the highest attack stats?
# 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 6 Pokémon from the second generation have the highest attack stats?
df.columns = ['number', 'name', 'type1', 'type2', 'total', 'hp', 'attack', 'defense', 'sp_attack', 'sp_defense', 'speed', 'generation', 'legendary']
# Expected output type: is list[category], this will be checked.
return | 20250129013715 |
36 | What are the top 5 special defense stats in the dataset? | 051_Pokemon | dev | list[number] | ['sp_defense'] | 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": "number",
"type": "uint16"
},
{
"name": "name",
"type": "category"
},
{
"name": "type1",
"type": "category"
},
{
"name": "type2",
"type": "category"
},
{
"name": "total",
"type": "uint16"
},
{
"name": "hp",
"type": "uint8"
},
{
"name": "attack",
"type": "uint8"
},
{
"name": "defense",
"type": "uint8"
},
{
"name": "sp_attack",
"type": "uint8"
},
{
"name": "sp_defense",
"type": "uint8"
},
{
"name": "speed",
"type": "uint8"
},
{
"name": "generation",
"type": "uint8"
},
{
"name": "legendary",
"type": "bool"
}
]
}
# Description of dataframe columns.
df_descrption = {
"count":{
"number":1072.0,
"total":1072.0,
"hp":1072.0,
"attack":1072.0,
"defense":1072.0,
"sp_attack":1072.0,
"sp_defense":1072.0,
"speed":1072.0,
"generation":1072.0
},
"mean":{
"number":445.2192164179,
"total":440.885261194,
"hp":70.4869402985,
"attack":80.9384328358,
"defense":74.9682835821,
"sp_attack":73.2733208955,
"sp_defense":72.4766791045,
"speed":68.7929104478,
"generation":4.2947761194
},
"std":{
"number":267.77280649,
"total":121.3790771926,
"hp":26.8680389923,
"attack":32.4635820748,
"defense":31.2080593873,
"sp_attack":32.6431190064,
"sp_defense":27.9342534926,
"speed":30.0762806451,
"generation":2.3464717631
},
"min":{
"number":1.0,
"total":175.0,
"hp":1.0,
"attack":5.0,
"defense":5.0,
"sp_attack":10.0,
"sp_defense":20.0,
"speed":5.0,
"generation":0.0
},
"25%":{
"number":209.75,
"total":330.0,
"hp":50.0,
"attack":56.0,
"defense":52.0,
"sp_attack":50.0,
"sp_defense":50.0,
"speed":45.0,
"generation":2.0
},
"50%":{
"number":442.5,
"total":460.5,
"hp":68.0,
"attack":80.0,
"defense":70.0,
"sp_attack":65.0,
"sp_defense":70.0,
"speed":65.0,
"generation":4.0
},
"75%":{
"number":681.25,
"total":519.25,
"hp":84.0,
"attack":100.0,
"defense":90.0,
"sp_attack":95.0,
"sp_defense":90.0,
"speed":90.0,
"generation":6.0
},
"max":{
"number":898.0,
"total":1125.0,
"hp":255.0,
"attack":190.0,
"defense":250.0,
"sp_attack":194.0,
"sp_defense":250.0,
"speed":200.0,
"generation":8.0
}
}
# Randome sample of 10 rows from the dataframe.
df_random_sample = {
"count":{
"number":1072.0,
"total":1072.0,
"hp":1072.0,
"attack":1072.0,
"defense":1072.0,
"sp_attack":1072.0,
"sp_defense":1072.0,
"speed":1072.0,
"generation":1072.0
},
"mean":{
"number":445.2192164179,
"total":440.885261194,
"hp":70.4869402985,
"attack":80.9384328358,
"defense":74.9682835821,
"sp_attack":73.2733208955,
"sp_defense":72.4766791045,
"speed":68.7929104478,
"generation":4.2947761194
},
"std":{
"number":267.77280649,
"total":121.3790771926,
"hp":26.8680389923,
"attack":32.4635820748,
"defense":31.2080593873,
"sp_attack":32.6431190064,
"sp_defense":27.9342534926,
"speed":30.0762806451,
"generation":2.3464717631
},
"min":{
"number":1.0,
"total":175.0,
"hp":1.0,
"attack":5.0,
"defense":5.0,
"sp_attack":10.0,
"sp_defense":20.0,
"speed":5.0,
"generation":0.0
},
"25%":{
"number":209.75,
"total":330.0,
"hp":50.0,
"attack":56.0,
"defense":52.0,
"sp_attack":50.0,
"sp_defense":50.0,
"speed":45.0,
"generation":2.0
},
"50%":{
"number":442.5,
"total":460.5,
"hp":68.0,
"attack":80.0,
"defense":70.0,
"sp_attack":65.0,
"sp_defense":70.0,
"speed":65.0,
"generation":4.0
},
"75%":{
"number":681.25,
"total":519.25,
"hp":84.0,
"attack":100.0,
"defense":90.0,
"sp_attack":95.0,
"sp_defense":90.0,
"speed":90.0,
"generation":6.0
},
"max":{
"number":898.0,
"total":1125.0,
"hp":255.0,
"attack":190.0,
"defense":250.0,
"sp_attack":194.0,
"sp_defense":250.0,
"speed":200.0,
"generation":8.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 special defense stats 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: What are the top 5 special defense stats in the dataset?
df.columns = ['number', 'name', 'type1', 'type2', 'total', 'hp', 'attack', 'defense', 'sp_attack', 'sp_defense', 'speed', 'generation', 'legendary']
# Expected output type: is list[number], this will be checked.
return | 20250129013715 |
37 | List the lowest 2 defense stats of legendary Pokémon. | 051_Pokemon | dev | list[number] | ['legendary', 'defense'] | 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": "number",
"type": "uint16"
},
{
"name": "name",
"type": "category"
},
{
"name": "type1",
"type": "category"
},
{
"name": "type2",
"type": "category"
},
{
"name": "total",
"type": "uint16"
},
{
"name": "hp",
"type": "uint8"
},
{
"name": "attack",
"type": "uint8"
},
{
"name": "defense",
"type": "uint8"
},
{
"name": "sp_attack",
"type": "uint8"
},
{
"name": "sp_defense",
"type": "uint8"
},
{
"name": "speed",
"type": "uint8"
},
{
"name": "generation",
"type": "uint8"
},
{
"name": "legendary",
"type": "bool"
}
]
}
# Description of dataframe columns.
df_descrption = {
"count":{
"number":1072.0,
"total":1072.0,
"hp":1072.0,
"attack":1072.0,
"defense":1072.0,
"sp_attack":1072.0,
"sp_defense":1072.0,
"speed":1072.0,
"generation":1072.0
},
"mean":{
"number":445.2192164179,
"total":440.885261194,
"hp":70.4869402985,
"attack":80.9384328358,
"defense":74.9682835821,
"sp_attack":73.2733208955,
"sp_defense":72.4766791045,
"speed":68.7929104478,
"generation":4.2947761194
},
"std":{
"number":267.77280649,
"total":121.3790771926,
"hp":26.8680389923,
"attack":32.4635820748,
"defense":31.2080593873,
"sp_attack":32.6431190064,
"sp_defense":27.9342534926,
"speed":30.0762806451,
"generation":2.3464717631
},
"min":{
"number":1.0,
"total":175.0,
"hp":1.0,
"attack":5.0,
"defense":5.0,
"sp_attack":10.0,
"sp_defense":20.0,
"speed":5.0,
"generation":0.0
},
"25%":{
"number":209.75,
"total":330.0,
"hp":50.0,
"attack":56.0,
"defense":52.0,
"sp_attack":50.0,
"sp_defense":50.0,
"speed":45.0,
"generation":2.0
},
"50%":{
"number":442.5,
"total":460.5,
"hp":68.0,
"attack":80.0,
"defense":70.0,
"sp_attack":65.0,
"sp_defense":70.0,
"speed":65.0,
"generation":4.0
},
"75%":{
"number":681.25,
"total":519.25,
"hp":84.0,
"attack":100.0,
"defense":90.0,
"sp_attack":95.0,
"sp_defense":90.0,
"speed":90.0,
"generation":6.0
},
"max":{
"number":898.0,
"total":1125.0,
"hp":255.0,
"attack":190.0,
"defense":250.0,
"sp_attack":194.0,
"sp_defense":250.0,
"speed":200.0,
"generation":8.0
}
}
# Randome sample of 10 rows from the dataframe.
df_random_sample = {
"count":{
"number":1072.0,
"total":1072.0,
"hp":1072.0,
"attack":1072.0,
"defense":1072.0,
"sp_attack":1072.0,
"sp_defense":1072.0,
"speed":1072.0,
"generation":1072.0
},
"mean":{
"number":445.2192164179,
"total":440.885261194,
"hp":70.4869402985,
"attack":80.9384328358,
"defense":74.9682835821,
"sp_attack":73.2733208955,
"sp_defense":72.4766791045,
"speed":68.7929104478,
"generation":4.2947761194
},
"std":{
"number":267.77280649,
"total":121.3790771926,
"hp":26.8680389923,
"attack":32.4635820748,
"defense":31.2080593873,
"sp_attack":32.6431190064,
"sp_defense":27.9342534926,
"speed":30.0762806451,
"generation":2.3464717631
},
"min":{
"number":1.0,
"total":175.0,
"hp":1.0,
"attack":5.0,
"defense":5.0,
"sp_attack":10.0,
"sp_defense":20.0,
"speed":5.0,
"generation":0.0
},
"25%":{
"number":209.75,
"total":330.0,
"hp":50.0,
"attack":56.0,
"defense":52.0,
"sp_attack":50.0,
"sp_defense":50.0,
"speed":45.0,
"generation":2.0
},
"50%":{
"number":442.5,
"total":460.5,
"hp":68.0,
"attack":80.0,
"defense":70.0,
"sp_attack":65.0,
"sp_defense":70.0,
"speed":65.0,
"generation":4.0
},
"75%":{
"number":681.25,
"total":519.25,
"hp":84.0,
"attack":100.0,
"defense":90.0,
"sp_attack":95.0,
"sp_defense":90.0,
"speed":90.0,
"generation":6.0
},
"max":{
"number":898.0,
"total":1125.0,
"hp":255.0,
"attack":190.0,
"defense":250.0,
"sp_attack":194.0,
"sp_defense":250.0,
"speed":200.0,
"generation":8.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 lowest 2 defense stats of legendary Pokémon.
# 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 lowest 2 defense stats of legendary Pokémon.
df.columns = ['number', 'name', 'type1', 'type2', 'total', 'hp', 'attack', 'defense', 'sp_attack', 'sp_defense', 'speed', 'generation', 'legendary']
# Expected output type: is list[number], this will be checked.
return | 20250129013715 |
38 | What are the 2 highest speed stats of Pokémon in the fourth generation? | 051_Pokemon | dev | list[number] | ['generation', 'speed'] | 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": "number",
"type": "uint16"
},
{
"name": "name",
"type": "category"
},
{
"name": "type1",
"type": "category"
},
{
"name": "type2",
"type": "category"
},
{
"name": "total",
"type": "uint16"
},
{
"name": "hp",
"type": "uint8"
},
{
"name": "attack",
"type": "uint8"
},
{
"name": "defense",
"type": "uint8"
},
{
"name": "sp_attack",
"type": "uint8"
},
{
"name": "sp_defense",
"type": "uint8"
},
{
"name": "speed",
"type": "uint8"
},
{
"name": "generation",
"type": "uint8"
},
{
"name": "legendary",
"type": "bool"
}
]
}
# Description of dataframe columns.
df_descrption = {
"count":{
"number":1072.0,
"total":1072.0,
"hp":1072.0,
"attack":1072.0,
"defense":1072.0,
"sp_attack":1072.0,
"sp_defense":1072.0,
"speed":1072.0,
"generation":1072.0
},
"mean":{
"number":445.2192164179,
"total":440.885261194,
"hp":70.4869402985,
"attack":80.9384328358,
"defense":74.9682835821,
"sp_attack":73.2733208955,
"sp_defense":72.4766791045,
"speed":68.7929104478,
"generation":4.2947761194
},
"std":{
"number":267.77280649,
"total":121.3790771926,
"hp":26.8680389923,
"attack":32.4635820748,
"defense":31.2080593873,
"sp_attack":32.6431190064,
"sp_defense":27.9342534926,
"speed":30.0762806451,
"generation":2.3464717631
},
"min":{
"number":1.0,
"total":175.0,
"hp":1.0,
"attack":5.0,
"defense":5.0,
"sp_attack":10.0,
"sp_defense":20.0,
"speed":5.0,
"generation":0.0
},
"25%":{
"number":209.75,
"total":330.0,
"hp":50.0,
"attack":56.0,
"defense":52.0,
"sp_attack":50.0,
"sp_defense":50.0,
"speed":45.0,
"generation":2.0
},
"50%":{
"number":442.5,
"total":460.5,
"hp":68.0,
"attack":80.0,
"defense":70.0,
"sp_attack":65.0,
"sp_defense":70.0,
"speed":65.0,
"generation":4.0
},
"75%":{
"number":681.25,
"total":519.25,
"hp":84.0,
"attack":100.0,
"defense":90.0,
"sp_attack":95.0,
"sp_defense":90.0,
"speed":90.0,
"generation":6.0
},
"max":{
"number":898.0,
"total":1125.0,
"hp":255.0,
"attack":190.0,
"defense":250.0,
"sp_attack":194.0,
"sp_defense":250.0,
"speed":200.0,
"generation":8.0
}
}
# Randome sample of 10 rows from the dataframe.
df_random_sample = {
"count":{
"number":1072.0,
"total":1072.0,
"hp":1072.0,
"attack":1072.0,
"defense":1072.0,
"sp_attack":1072.0,
"sp_defense":1072.0,
"speed":1072.0,
"generation":1072.0
},
"mean":{
"number":445.2192164179,
"total":440.885261194,
"hp":70.4869402985,
"attack":80.9384328358,
"defense":74.9682835821,
"sp_attack":73.2733208955,
"sp_defense":72.4766791045,
"speed":68.7929104478,
"generation":4.2947761194
},
"std":{
"number":267.77280649,
"total":121.3790771926,
"hp":26.8680389923,
"attack":32.4635820748,
"defense":31.2080593873,
"sp_attack":32.6431190064,
"sp_defense":27.9342534926,
"speed":30.0762806451,
"generation":2.3464717631
},
"min":{
"number":1.0,
"total":175.0,
"hp":1.0,
"attack":5.0,
"defense":5.0,
"sp_attack":10.0,
"sp_defense":20.0,
"speed":5.0,
"generation":0.0
},
"25%":{
"number":209.75,
"total":330.0,
"hp":50.0,
"attack":56.0,
"defense":52.0,
"sp_attack":50.0,
"sp_defense":50.0,
"speed":45.0,
"generation":2.0
},
"50%":{
"number":442.5,
"total":460.5,
"hp":68.0,
"attack":80.0,
"defense":70.0,
"sp_attack":65.0,
"sp_defense":70.0,
"speed":65.0,
"generation":4.0
},
"75%":{
"number":681.25,
"total":519.25,
"hp":84.0,
"attack":100.0,
"defense":90.0,
"sp_attack":95.0,
"sp_defense":90.0,
"speed":90.0,
"generation":6.0
},
"max":{
"number":898.0,
"total":1125.0,
"hp":255.0,
"attack":190.0,
"defense":250.0,
"sp_attack":194.0,
"sp_defense":250.0,
"speed":200.0,
"generation":8.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 2 highest speed stats of Pokémon in the fourth generation?
# 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 2 highest speed stats of Pokémon in the fourth generation?
df.columns = ['number', 'name', 'type1', 'type2', 'total', 'hp', 'attack', 'defense', 'sp_attack', 'sp_defense', 'speed', 'generation', 'legendary']
# Expected output type: is list[number], this will be checked.
return | 20250129013715 |
39 | list the 6 lowest total stats of non-legendary Pokémon. | 051_Pokemon | dev | list[number] | ['legendary', 'total'] | 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": "number",
"type": "uint16"
},
{
"name": "name",
"type": "category"
},
{
"name": "type1",
"type": "category"
},
{
"name": "type2",
"type": "category"
},
{
"name": "total",
"type": "uint16"
},
{
"name": "hp",
"type": "uint8"
},
{
"name": "attack",
"type": "uint8"
},
{
"name": "defense",
"type": "uint8"
},
{
"name": "sp_attack",
"type": "uint8"
},
{
"name": "sp_defense",
"type": "uint8"
},
{
"name": "speed",
"type": "uint8"
},
{
"name": "generation",
"type": "uint8"
},
{
"name": "legendary",
"type": "bool"
}
]
}
# Description of dataframe columns.
df_descrption = {
"count":{
"number":1072.0,
"total":1072.0,
"hp":1072.0,
"attack":1072.0,
"defense":1072.0,
"sp_attack":1072.0,
"sp_defense":1072.0,
"speed":1072.0,
"generation":1072.0
},
"mean":{
"number":445.2192164179,
"total":440.885261194,
"hp":70.4869402985,
"attack":80.9384328358,
"defense":74.9682835821,
"sp_attack":73.2733208955,
"sp_defense":72.4766791045,
"speed":68.7929104478,
"generation":4.2947761194
},
"std":{
"number":267.77280649,
"total":121.3790771926,
"hp":26.8680389923,
"attack":32.4635820748,
"defense":31.2080593873,
"sp_attack":32.6431190064,
"sp_defense":27.9342534926,
"speed":30.0762806451,
"generation":2.3464717631
},
"min":{
"number":1.0,
"total":175.0,
"hp":1.0,
"attack":5.0,
"defense":5.0,
"sp_attack":10.0,
"sp_defense":20.0,
"speed":5.0,
"generation":0.0
},
"25%":{
"number":209.75,
"total":330.0,
"hp":50.0,
"attack":56.0,
"defense":52.0,
"sp_attack":50.0,
"sp_defense":50.0,
"speed":45.0,
"generation":2.0
},
"50%":{
"number":442.5,
"total":460.5,
"hp":68.0,
"attack":80.0,
"defense":70.0,
"sp_attack":65.0,
"sp_defense":70.0,
"speed":65.0,
"generation":4.0
},
"75%":{
"number":681.25,
"total":519.25,
"hp":84.0,
"attack":100.0,
"defense":90.0,
"sp_attack":95.0,
"sp_defense":90.0,
"speed":90.0,
"generation":6.0
},
"max":{
"number":898.0,
"total":1125.0,
"hp":255.0,
"attack":190.0,
"defense":250.0,
"sp_attack":194.0,
"sp_defense":250.0,
"speed":200.0,
"generation":8.0
}
}
# Randome sample of 10 rows from the dataframe.
df_random_sample = {
"count":{
"number":1072.0,
"total":1072.0,
"hp":1072.0,
"attack":1072.0,
"defense":1072.0,
"sp_attack":1072.0,
"sp_defense":1072.0,
"speed":1072.0,
"generation":1072.0
},
"mean":{
"number":445.2192164179,
"total":440.885261194,
"hp":70.4869402985,
"attack":80.9384328358,
"defense":74.9682835821,
"sp_attack":73.2733208955,
"sp_defense":72.4766791045,
"speed":68.7929104478,
"generation":4.2947761194
},
"std":{
"number":267.77280649,
"total":121.3790771926,
"hp":26.8680389923,
"attack":32.4635820748,
"defense":31.2080593873,
"sp_attack":32.6431190064,
"sp_defense":27.9342534926,
"speed":30.0762806451,
"generation":2.3464717631
},
"min":{
"number":1.0,
"total":175.0,
"hp":1.0,
"attack":5.0,
"defense":5.0,
"sp_attack":10.0,
"sp_defense":20.0,
"speed":5.0,
"generation":0.0
},
"25%":{
"number":209.75,
"total":330.0,
"hp":50.0,
"attack":56.0,
"defense":52.0,
"sp_attack":50.0,
"sp_defense":50.0,
"speed":45.0,
"generation":2.0
},
"50%":{
"number":442.5,
"total":460.5,
"hp":68.0,
"attack":80.0,
"defense":70.0,
"sp_attack":65.0,
"sp_defense":70.0,
"speed":65.0,
"generation":4.0
},
"75%":{
"number":681.25,
"total":519.25,
"hp":84.0,
"attack":100.0,
"defense":90.0,
"sp_attack":95.0,
"sp_defense":90.0,
"speed":90.0,
"generation":6.0
},
"max":{
"number":898.0,
"total":1125.0,
"hp":255.0,
"attack":190.0,
"defense":250.0,
"sp_attack":194.0,
"sp_defense":250.0,
"speed":200.0,
"generation":8.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 6 lowest total stats of non-legendary Pokémon.
# 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 6 lowest total stats of non-legendary Pokémon.
df.columns = ['number', 'name', 'type1', 'type2', 'total', 'hp', 'attack', 'defense', 'sp_attack', 'sp_defense', 'speed', 'generation', 'legendary']
# Expected output type: is list[number], this will be checked.
return | 20250129013715 |
40 | Is the maximum level of Extraversion greater than the maximum level of Agreeableness? | 052_Professional | dev | boolean | ['Extraversion', 'Agreeableness'] | 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": "Profession",
"type": "category"
},
{
"name": "Openness",
"type": "float64"
},
{
"name": "Conscientousness",
"type": "float64"
},
{
"name": "Extraversion",
"type": "float64"
},
{
"name": "Agreeableness",
"type": "float64"
},
{
"name": "Emotional_Range",
"type": "float64"
},
{
"name": "Conversation",
"type": "float64"
},
{
"name": "Openness to Change",
"type": "float64"
},
{
"name": "Hedonism",
"type": "float64"
},
{
"name": "Self-enhancement",
"type": "float64"
},
{
"name": "Self-transcendence",
"type": "float64"
},
{
"name": "n",
"type": "uint16"
}
]
}
# Description of dataframe columns.
df_descrption = {
"count":{
"Openness":1227.0,
"Conscientousness":1227.0,
"Extraversion":1227.0,
"Agreeableness":1227.0,
"Emotional_Range":1227.0,
"Conversation":1227.0,
"Openness to Change":1227.0,
"Hedonism":1227.0,
"Self-enhancement":1227.0,
"Self-transcendence":1227.0,
"n":1227.0
},
"mean":{
"Openness":0.6818599599,
"Conscientousness":0.5494864934,
"Extraversion":0.5999407609,
"Agreeableness":0.3300650815,
"Emotional_Range":0.6150157566,
"Conversation":0.1954283756,
"Openness to Change":0.4297269623,
"Hedonism":0.1854087597,
"Self-enhancement":0.3530469421,
"Self-transcendence":0.2674535075,
"n":82.4392828036
},
"std":{
"Openness":0.1062055359,
"Conscientousness":0.1504663216,
"Extraversion":0.1730540692,
"Agreeableness":0.1775762646,
"Emotional_Range":0.1320494061,
"Conversation":0.1168313736,
"Openness to Change":0.0884607635,
"Hedonism":0.101973799,
"Self-enhancement":0.1235634015,
"Self-transcendence":0.098292791,
"n":25.8098237833
},
"min":{
"Openness":0.2152542646,
"Conscientousness":0.1085605602,
"Extraversion":0.1022540075,
"Agreeableness":0.017733368,
"Emotional_Range":0.165238157,
"Conversation":0.0124883557,
"Openness to Change":0.1470387283,
"Hedonism":0.0290857203,
"Self-enhancement":0.0298680791,
"Self-transcendence":0.0353641396,
"n":50.0
},
"25%":{
"Openness":0.6159645036,
"Conscientousness":0.453015216,
"Extraversion":0.5015413749,
"Agreeableness":0.1927662685,
"Emotional_Range":0.5281815531,
"Conversation":0.1087056755,
"Openness to Change":0.3720593776,
"Hedonism":0.1141935636,
"Self-enhancement":0.2732188024,
"Self-transcendence":0.2014597353,
"n":72.0
},
"50%":{
"Openness":0.6877670374,
"Conscientousness":0.5529477526,
"Extraversion":0.6337253665,
"Agreeableness":0.3236347592,
"Emotional_Range":0.6168124863,
"Conversation":0.1734567056,
"Openness to Change":0.430397799,
"Hedonism":0.158430861,
"Self-enhancement":0.3399782773,
"Self-transcendence":0.2556183242,
"n":76.0
},
"75%":{
"Openness":0.7561884082,
"Conscientousness":0.6510142733,
"Extraversion":0.7274713099,
"Agreeableness":0.4492181284,
"Emotional_Range":0.7010886899,
"Conversation":0.2547882803,
"Openness to Change":0.4846609371,
"Hedonism":0.2265744616,
"Self-enhancement":0.4299178279,
"Self-transcendence":0.3220190548,
"n":80.0
},
"max":{
"Openness":0.95992792,
"Conscientousness":0.960118167,
"Extraversion":0.9794365923,
"Agreeableness":0.8993661095,
"Emotional_Range":0.9415769334,
"Conversation":0.7793932512,
"Openness to Change":0.7557249986,
"Hedonism":0.680102991,
"Self-enhancement":0.7826336181,
"Self-transcendence":0.6273682888,
"n":313.0
}
}
# Randome sample of 10 rows from the dataframe.
df_random_sample = {
"count":{
"Openness":1227.0,
"Conscientousness":1227.0,
"Extraversion":1227.0,
"Agreeableness":1227.0,
"Emotional_Range":1227.0,
"Conversation":1227.0,
"Openness to Change":1227.0,
"Hedonism":1227.0,
"Self-enhancement":1227.0,
"Self-transcendence":1227.0,
"n":1227.0
},
"mean":{
"Openness":0.6818599599,
"Conscientousness":0.5494864934,
"Extraversion":0.5999407609,
"Agreeableness":0.3300650815,
"Emotional_Range":0.6150157566,
"Conversation":0.1954283756,
"Openness to Change":0.4297269623,
"Hedonism":0.1854087597,
"Self-enhancement":0.3530469421,
"Self-transcendence":0.2674535075,
"n":82.4392828036
},
"std":{
"Openness":0.1062055359,
"Conscientousness":0.1504663216,
"Extraversion":0.1730540692,
"Agreeableness":0.1775762646,
"Emotional_Range":0.1320494061,
"Conversation":0.1168313736,
"Openness to Change":0.0884607635,
"Hedonism":0.101973799,
"Self-enhancement":0.1235634015,
"Self-transcendence":0.098292791,
"n":25.8098237833
},
"min":{
"Openness":0.2152542646,
"Conscientousness":0.1085605602,
"Extraversion":0.1022540075,
"Agreeableness":0.017733368,
"Emotional_Range":0.165238157,
"Conversation":0.0124883557,
"Openness to Change":0.1470387283,
"Hedonism":0.0290857203,
"Self-enhancement":0.0298680791,
"Self-transcendence":0.0353641396,
"n":50.0
},
"25%":{
"Openness":0.6159645036,
"Conscientousness":0.453015216,
"Extraversion":0.5015413749,
"Agreeableness":0.1927662685,
"Emotional_Range":0.5281815531,
"Conversation":0.1087056755,
"Openness to Change":0.3720593776,
"Hedonism":0.1141935636,
"Self-enhancement":0.2732188024,
"Self-transcendence":0.2014597353,
"n":72.0
},
"50%":{
"Openness":0.6877670374,
"Conscientousness":0.5529477526,
"Extraversion":0.6337253665,
"Agreeableness":0.3236347592,
"Emotional_Range":0.6168124863,
"Conversation":0.1734567056,
"Openness to Change":0.430397799,
"Hedonism":0.158430861,
"Self-enhancement":0.3399782773,
"Self-transcendence":0.2556183242,
"n":76.0
},
"75%":{
"Openness":0.7561884082,
"Conscientousness":0.6510142733,
"Extraversion":0.7274713099,
"Agreeableness":0.4492181284,
"Emotional_Range":0.7010886899,
"Conversation":0.2547882803,
"Openness to Change":0.4846609371,
"Hedonism":0.2265744616,
"Self-enhancement":0.4299178279,
"Self-transcendence":0.3220190548,
"n":80.0
},
"max":{
"Openness":0.95992792,
"Conscientousness":0.960118167,
"Extraversion":0.9794365923,
"Agreeableness":0.8993661095,
"Emotional_Range":0.9415769334,
"Conversation":0.7793932512,
"Openness to Change":0.7557249986,
"Hedonism":0.680102991,
"Self-enhancement":0.7826336181,
"Self-transcendence":0.6273682888,
"n":313.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 the maximum level of Extraversion greater than the maximum level of Agreeableness?
# 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 the maximum level of Extraversion greater than the maximum level of Agreeableness?
df.columns = ['Profession', 'Openness', 'Conscientousness', 'Extraversion', 'Agreeableness', 'Emotional_Range', 'Conversation', 'Openness to Change', 'Hedonism', 'Self-enhancement', 'Self-transcendence', 'n']
# Expected output type: is boolean, this will be checked.
return | 20250129013715 |
41 | Is the profession with the highest Openness the same as the profession with the highest Conscientousness? | 052_Professional | dev | boolean | ['Profession', 'Openness', 'Conscientousness'] | 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": "Profession",
"type": "category"
},
{
"name": "Openness",
"type": "float64"
},
{
"name": "Conscientousness",
"type": "float64"
},
{
"name": "Extraversion",
"type": "float64"
},
{
"name": "Agreeableness",
"type": "float64"
},
{
"name": "Emotional_Range",
"type": "float64"
},
{
"name": "Conversation",
"type": "float64"
},
{
"name": "Openness to Change",
"type": "float64"
},
{
"name": "Hedonism",
"type": "float64"
},
{
"name": "Self-enhancement",
"type": "float64"
},
{
"name": "Self-transcendence",
"type": "float64"
},
{
"name": "n",
"type": "uint16"
}
]
}
# Description of dataframe columns.
df_descrption = {
"count":{
"Openness":1227.0,
"Conscientousness":1227.0,
"Extraversion":1227.0,
"Agreeableness":1227.0,
"Emotional_Range":1227.0,
"Conversation":1227.0,
"Openness to Change":1227.0,
"Hedonism":1227.0,
"Self-enhancement":1227.0,
"Self-transcendence":1227.0,
"n":1227.0
},
"mean":{
"Openness":0.6818599599,
"Conscientousness":0.5494864934,
"Extraversion":0.5999407609,
"Agreeableness":0.3300650815,
"Emotional_Range":0.6150157566,
"Conversation":0.1954283756,
"Openness to Change":0.4297269623,
"Hedonism":0.1854087597,
"Self-enhancement":0.3530469421,
"Self-transcendence":0.2674535075,
"n":82.4392828036
},
"std":{
"Openness":0.1062055359,
"Conscientousness":0.1504663216,
"Extraversion":0.1730540692,
"Agreeableness":0.1775762646,
"Emotional_Range":0.1320494061,
"Conversation":0.1168313736,
"Openness to Change":0.0884607635,
"Hedonism":0.101973799,
"Self-enhancement":0.1235634015,
"Self-transcendence":0.098292791,
"n":25.8098237833
},
"min":{
"Openness":0.2152542646,
"Conscientousness":0.1085605602,
"Extraversion":0.1022540075,
"Agreeableness":0.017733368,
"Emotional_Range":0.165238157,
"Conversation":0.0124883557,
"Openness to Change":0.1470387283,
"Hedonism":0.0290857203,
"Self-enhancement":0.0298680791,
"Self-transcendence":0.0353641396,
"n":50.0
},
"25%":{
"Openness":0.6159645036,
"Conscientousness":0.453015216,
"Extraversion":0.5015413749,
"Agreeableness":0.1927662685,
"Emotional_Range":0.5281815531,
"Conversation":0.1087056755,
"Openness to Change":0.3720593776,
"Hedonism":0.1141935636,
"Self-enhancement":0.2732188024,
"Self-transcendence":0.2014597353,
"n":72.0
},
"50%":{
"Openness":0.6877670374,
"Conscientousness":0.5529477526,
"Extraversion":0.6337253665,
"Agreeableness":0.3236347592,
"Emotional_Range":0.6168124863,
"Conversation":0.1734567056,
"Openness to Change":0.430397799,
"Hedonism":0.158430861,
"Self-enhancement":0.3399782773,
"Self-transcendence":0.2556183242,
"n":76.0
},
"75%":{
"Openness":0.7561884082,
"Conscientousness":0.6510142733,
"Extraversion":0.7274713099,
"Agreeableness":0.4492181284,
"Emotional_Range":0.7010886899,
"Conversation":0.2547882803,
"Openness to Change":0.4846609371,
"Hedonism":0.2265744616,
"Self-enhancement":0.4299178279,
"Self-transcendence":0.3220190548,
"n":80.0
},
"max":{
"Openness":0.95992792,
"Conscientousness":0.960118167,
"Extraversion":0.9794365923,
"Agreeableness":0.8993661095,
"Emotional_Range":0.9415769334,
"Conversation":0.7793932512,
"Openness to Change":0.7557249986,
"Hedonism":0.680102991,
"Self-enhancement":0.7826336181,
"Self-transcendence":0.6273682888,
"n":313.0
}
}
# Randome sample of 10 rows from the dataframe.
df_random_sample = {
"count":{
"Openness":1227.0,
"Conscientousness":1227.0,
"Extraversion":1227.0,
"Agreeableness":1227.0,
"Emotional_Range":1227.0,
"Conversation":1227.0,
"Openness to Change":1227.0,
"Hedonism":1227.0,
"Self-enhancement":1227.0,
"Self-transcendence":1227.0,
"n":1227.0
},
"mean":{
"Openness":0.6818599599,
"Conscientousness":0.5494864934,
"Extraversion":0.5999407609,
"Agreeableness":0.3300650815,
"Emotional_Range":0.6150157566,
"Conversation":0.1954283756,
"Openness to Change":0.4297269623,
"Hedonism":0.1854087597,
"Self-enhancement":0.3530469421,
"Self-transcendence":0.2674535075,
"n":82.4392828036
},
"std":{
"Openness":0.1062055359,
"Conscientousness":0.1504663216,
"Extraversion":0.1730540692,
"Agreeableness":0.1775762646,
"Emotional_Range":0.1320494061,
"Conversation":0.1168313736,
"Openness to Change":0.0884607635,
"Hedonism":0.101973799,
"Self-enhancement":0.1235634015,
"Self-transcendence":0.098292791,
"n":25.8098237833
},
"min":{
"Openness":0.2152542646,
"Conscientousness":0.1085605602,
"Extraversion":0.1022540075,
"Agreeableness":0.017733368,
"Emotional_Range":0.165238157,
"Conversation":0.0124883557,
"Openness to Change":0.1470387283,
"Hedonism":0.0290857203,
"Self-enhancement":0.0298680791,
"Self-transcendence":0.0353641396,
"n":50.0
},
"25%":{
"Openness":0.6159645036,
"Conscientousness":0.453015216,
"Extraversion":0.5015413749,
"Agreeableness":0.1927662685,
"Emotional_Range":0.5281815531,
"Conversation":0.1087056755,
"Openness to Change":0.3720593776,
"Hedonism":0.1141935636,
"Self-enhancement":0.2732188024,
"Self-transcendence":0.2014597353,
"n":72.0
},
"50%":{
"Openness":0.6877670374,
"Conscientousness":0.5529477526,
"Extraversion":0.6337253665,
"Agreeableness":0.3236347592,
"Emotional_Range":0.6168124863,
"Conversation":0.1734567056,
"Openness to Change":0.430397799,
"Hedonism":0.158430861,
"Self-enhancement":0.3399782773,
"Self-transcendence":0.2556183242,
"n":76.0
},
"75%":{
"Openness":0.7561884082,
"Conscientousness":0.6510142733,
"Extraversion":0.7274713099,
"Agreeableness":0.4492181284,
"Emotional_Range":0.7010886899,
"Conversation":0.2547882803,
"Openness to Change":0.4846609371,
"Hedonism":0.2265744616,
"Self-enhancement":0.4299178279,
"Self-transcendence":0.3220190548,
"n":80.0
},
"max":{
"Openness":0.95992792,
"Conscientousness":0.960118167,
"Extraversion":0.9794365923,
"Agreeableness":0.8993661095,
"Emotional_Range":0.9415769334,
"Conversation":0.7793932512,
"Openness to Change":0.7557249986,
"Hedonism":0.680102991,
"Self-enhancement":0.7826336181,
"Self-transcendence":0.6273682888,
"n":313.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 the profession with the highest Openness the same as the profession with the highest Conscientousness?
# 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 the profession with the highest Openness the same as the profession with the highest Conscientousness?
df.columns = ['Profession', 'Openness', 'Conscientousness', 'Extraversion', 'Agreeableness', 'Emotional_Range', 'Conversation', 'Openness to Change', 'Hedonism', 'Self-enhancement', 'Self-transcendence', 'n']
# Expected output type: is boolean, this will be checked.
return | 20250129013715 |
42 | Does the profession with the lowest Emotional_Range also have the lowest level of Conversation? | 052_Professional | dev | boolean | ['Profession', 'Emotional_Range', 'Conversation'] | 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": "Profession",
"type": "category"
},
{
"name": "Openness",
"type": "float64"
},
{
"name": "Conscientousness",
"type": "float64"
},
{
"name": "Extraversion",
"type": "float64"
},
{
"name": "Agreeableness",
"type": "float64"
},
{
"name": "Emotional_Range",
"type": "float64"
},
{
"name": "Conversation",
"type": "float64"
},
{
"name": "Openness to Change",
"type": "float64"
},
{
"name": "Hedonism",
"type": "float64"
},
{
"name": "Self-enhancement",
"type": "float64"
},
{
"name": "Self-transcendence",
"type": "float64"
},
{
"name": "n",
"type": "uint16"
}
]
}
# Description of dataframe columns.
df_descrption = {
"count":{
"Openness":1227.0,
"Conscientousness":1227.0,
"Extraversion":1227.0,
"Agreeableness":1227.0,
"Emotional_Range":1227.0,
"Conversation":1227.0,
"Openness to Change":1227.0,
"Hedonism":1227.0,
"Self-enhancement":1227.0,
"Self-transcendence":1227.0,
"n":1227.0
},
"mean":{
"Openness":0.6818599599,
"Conscientousness":0.5494864934,
"Extraversion":0.5999407609,
"Agreeableness":0.3300650815,
"Emotional_Range":0.6150157566,
"Conversation":0.1954283756,
"Openness to Change":0.4297269623,
"Hedonism":0.1854087597,
"Self-enhancement":0.3530469421,
"Self-transcendence":0.2674535075,
"n":82.4392828036
},
"std":{
"Openness":0.1062055359,
"Conscientousness":0.1504663216,
"Extraversion":0.1730540692,
"Agreeableness":0.1775762646,
"Emotional_Range":0.1320494061,
"Conversation":0.1168313736,
"Openness to Change":0.0884607635,
"Hedonism":0.101973799,
"Self-enhancement":0.1235634015,
"Self-transcendence":0.098292791,
"n":25.8098237833
},
"min":{
"Openness":0.2152542646,
"Conscientousness":0.1085605602,
"Extraversion":0.1022540075,
"Agreeableness":0.017733368,
"Emotional_Range":0.165238157,
"Conversation":0.0124883557,
"Openness to Change":0.1470387283,
"Hedonism":0.0290857203,
"Self-enhancement":0.0298680791,
"Self-transcendence":0.0353641396,
"n":50.0
},
"25%":{
"Openness":0.6159645036,
"Conscientousness":0.453015216,
"Extraversion":0.5015413749,
"Agreeableness":0.1927662685,
"Emotional_Range":0.5281815531,
"Conversation":0.1087056755,
"Openness to Change":0.3720593776,
"Hedonism":0.1141935636,
"Self-enhancement":0.2732188024,
"Self-transcendence":0.2014597353,
"n":72.0
},
"50%":{
"Openness":0.6877670374,
"Conscientousness":0.5529477526,
"Extraversion":0.6337253665,
"Agreeableness":0.3236347592,
"Emotional_Range":0.6168124863,
"Conversation":0.1734567056,
"Openness to Change":0.430397799,
"Hedonism":0.158430861,
"Self-enhancement":0.3399782773,
"Self-transcendence":0.2556183242,
"n":76.0
},
"75%":{
"Openness":0.7561884082,
"Conscientousness":0.6510142733,
"Extraversion":0.7274713099,
"Agreeableness":0.4492181284,
"Emotional_Range":0.7010886899,
"Conversation":0.2547882803,
"Openness to Change":0.4846609371,
"Hedonism":0.2265744616,
"Self-enhancement":0.4299178279,
"Self-transcendence":0.3220190548,
"n":80.0
},
"max":{
"Openness":0.95992792,
"Conscientousness":0.960118167,
"Extraversion":0.9794365923,
"Agreeableness":0.8993661095,
"Emotional_Range":0.9415769334,
"Conversation":0.7793932512,
"Openness to Change":0.7557249986,
"Hedonism":0.680102991,
"Self-enhancement":0.7826336181,
"Self-transcendence":0.6273682888,
"n":313.0
}
}
# Randome sample of 10 rows from the dataframe.
df_random_sample = {
"count":{
"Openness":1227.0,
"Conscientousness":1227.0,
"Extraversion":1227.0,
"Agreeableness":1227.0,
"Emotional_Range":1227.0,
"Conversation":1227.0,
"Openness to Change":1227.0,
"Hedonism":1227.0,
"Self-enhancement":1227.0,
"Self-transcendence":1227.0,
"n":1227.0
},
"mean":{
"Openness":0.6818599599,
"Conscientousness":0.5494864934,
"Extraversion":0.5999407609,
"Agreeableness":0.3300650815,
"Emotional_Range":0.6150157566,
"Conversation":0.1954283756,
"Openness to Change":0.4297269623,
"Hedonism":0.1854087597,
"Self-enhancement":0.3530469421,
"Self-transcendence":0.2674535075,
"n":82.4392828036
},
"std":{
"Openness":0.1062055359,
"Conscientousness":0.1504663216,
"Extraversion":0.1730540692,
"Agreeableness":0.1775762646,
"Emotional_Range":0.1320494061,
"Conversation":0.1168313736,
"Openness to Change":0.0884607635,
"Hedonism":0.101973799,
"Self-enhancement":0.1235634015,
"Self-transcendence":0.098292791,
"n":25.8098237833
},
"min":{
"Openness":0.2152542646,
"Conscientousness":0.1085605602,
"Extraversion":0.1022540075,
"Agreeableness":0.017733368,
"Emotional_Range":0.165238157,
"Conversation":0.0124883557,
"Openness to Change":0.1470387283,
"Hedonism":0.0290857203,
"Self-enhancement":0.0298680791,
"Self-transcendence":0.0353641396,
"n":50.0
},
"25%":{
"Openness":0.6159645036,
"Conscientousness":0.453015216,
"Extraversion":0.5015413749,
"Agreeableness":0.1927662685,
"Emotional_Range":0.5281815531,
"Conversation":0.1087056755,
"Openness to Change":0.3720593776,
"Hedonism":0.1141935636,
"Self-enhancement":0.2732188024,
"Self-transcendence":0.2014597353,
"n":72.0
},
"50%":{
"Openness":0.6877670374,
"Conscientousness":0.5529477526,
"Extraversion":0.6337253665,
"Agreeableness":0.3236347592,
"Emotional_Range":0.6168124863,
"Conversation":0.1734567056,
"Openness to Change":0.430397799,
"Hedonism":0.158430861,
"Self-enhancement":0.3399782773,
"Self-transcendence":0.2556183242,
"n":76.0
},
"75%":{
"Openness":0.7561884082,
"Conscientousness":0.6510142733,
"Extraversion":0.7274713099,
"Agreeableness":0.4492181284,
"Emotional_Range":0.7010886899,
"Conversation":0.2547882803,
"Openness to Change":0.4846609371,
"Hedonism":0.2265744616,
"Self-enhancement":0.4299178279,
"Self-transcendence":0.3220190548,
"n":80.0
},
"max":{
"Openness":0.95992792,
"Conscientousness":0.960118167,
"Extraversion":0.9794365923,
"Agreeableness":0.8993661095,
"Emotional_Range":0.9415769334,
"Conversation":0.7793932512,
"Openness to Change":0.7557249986,
"Hedonism":0.680102991,
"Self-enhancement":0.7826336181,
"Self-transcendence":0.6273682888,
"n":313.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 the profession with the lowest Emotional_Range also have the lowest level of Conversation?
# 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 the profession with the lowest Emotional_Range also have the lowest level of Conversation?
df.columns = ['Profession', 'Openness', 'Conscientousness', 'Extraversion', 'Agreeableness', 'Emotional_Range', 'Conversation', 'Openness to Change', 'Hedonism', 'Self-enhancement', 'Self-transcendence', 'n']
# Expected output type: is boolean, this will be checked.
return | 20250129013715 |
43 | Is the average level of Openness to Change higher than the average level of Hedonism? | 052_Professional | dev | boolean | ['Openness to Change', 'Hedonism'] | 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": "Profession",
"type": "category"
},
{
"name": "Openness",
"type": "float64"
},
{
"name": "Conscientousness",
"type": "float64"
},
{
"name": "Extraversion",
"type": "float64"
},
{
"name": "Agreeableness",
"type": "float64"
},
{
"name": "Emotional_Range",
"type": "float64"
},
{
"name": "Conversation",
"type": "float64"
},
{
"name": "Openness to Change",
"type": "float64"
},
{
"name": "Hedonism",
"type": "float64"
},
{
"name": "Self-enhancement",
"type": "float64"
},
{
"name": "Self-transcendence",
"type": "float64"
},
{
"name": "n",
"type": "uint16"
}
]
}
# Description of dataframe columns.
df_descrption = {
"count":{
"Openness":1227.0,
"Conscientousness":1227.0,
"Extraversion":1227.0,
"Agreeableness":1227.0,
"Emotional_Range":1227.0,
"Conversation":1227.0,
"Openness to Change":1227.0,
"Hedonism":1227.0,
"Self-enhancement":1227.0,
"Self-transcendence":1227.0,
"n":1227.0
},
"mean":{
"Openness":0.6818599599,
"Conscientousness":0.5494864934,
"Extraversion":0.5999407609,
"Agreeableness":0.3300650815,
"Emotional_Range":0.6150157566,
"Conversation":0.1954283756,
"Openness to Change":0.4297269623,
"Hedonism":0.1854087597,
"Self-enhancement":0.3530469421,
"Self-transcendence":0.2674535075,
"n":82.4392828036
},
"std":{
"Openness":0.1062055359,
"Conscientousness":0.1504663216,
"Extraversion":0.1730540692,
"Agreeableness":0.1775762646,
"Emotional_Range":0.1320494061,
"Conversation":0.1168313736,
"Openness to Change":0.0884607635,
"Hedonism":0.101973799,
"Self-enhancement":0.1235634015,
"Self-transcendence":0.098292791,
"n":25.8098237833
},
"min":{
"Openness":0.2152542646,
"Conscientousness":0.1085605602,
"Extraversion":0.1022540075,
"Agreeableness":0.017733368,
"Emotional_Range":0.165238157,
"Conversation":0.0124883557,
"Openness to Change":0.1470387283,
"Hedonism":0.0290857203,
"Self-enhancement":0.0298680791,
"Self-transcendence":0.0353641396,
"n":50.0
},
"25%":{
"Openness":0.6159645036,
"Conscientousness":0.453015216,
"Extraversion":0.5015413749,
"Agreeableness":0.1927662685,
"Emotional_Range":0.5281815531,
"Conversation":0.1087056755,
"Openness to Change":0.3720593776,
"Hedonism":0.1141935636,
"Self-enhancement":0.2732188024,
"Self-transcendence":0.2014597353,
"n":72.0
},
"50%":{
"Openness":0.6877670374,
"Conscientousness":0.5529477526,
"Extraversion":0.6337253665,
"Agreeableness":0.3236347592,
"Emotional_Range":0.6168124863,
"Conversation":0.1734567056,
"Openness to Change":0.430397799,
"Hedonism":0.158430861,
"Self-enhancement":0.3399782773,
"Self-transcendence":0.2556183242,
"n":76.0
},
"75%":{
"Openness":0.7561884082,
"Conscientousness":0.6510142733,
"Extraversion":0.7274713099,
"Agreeableness":0.4492181284,
"Emotional_Range":0.7010886899,
"Conversation":0.2547882803,
"Openness to Change":0.4846609371,
"Hedonism":0.2265744616,
"Self-enhancement":0.4299178279,
"Self-transcendence":0.3220190548,
"n":80.0
},
"max":{
"Openness":0.95992792,
"Conscientousness":0.960118167,
"Extraversion":0.9794365923,
"Agreeableness":0.8993661095,
"Emotional_Range":0.9415769334,
"Conversation":0.7793932512,
"Openness to Change":0.7557249986,
"Hedonism":0.680102991,
"Self-enhancement":0.7826336181,
"Self-transcendence":0.6273682888,
"n":313.0
}
}
# Randome sample of 10 rows from the dataframe.
df_random_sample = {
"count":{
"Openness":1227.0,
"Conscientousness":1227.0,
"Extraversion":1227.0,
"Agreeableness":1227.0,
"Emotional_Range":1227.0,
"Conversation":1227.0,
"Openness to Change":1227.0,
"Hedonism":1227.0,
"Self-enhancement":1227.0,
"Self-transcendence":1227.0,
"n":1227.0
},
"mean":{
"Openness":0.6818599599,
"Conscientousness":0.5494864934,
"Extraversion":0.5999407609,
"Agreeableness":0.3300650815,
"Emotional_Range":0.6150157566,
"Conversation":0.1954283756,
"Openness to Change":0.4297269623,
"Hedonism":0.1854087597,
"Self-enhancement":0.3530469421,
"Self-transcendence":0.2674535075,
"n":82.4392828036
},
"std":{
"Openness":0.1062055359,
"Conscientousness":0.1504663216,
"Extraversion":0.1730540692,
"Agreeableness":0.1775762646,
"Emotional_Range":0.1320494061,
"Conversation":0.1168313736,
"Openness to Change":0.0884607635,
"Hedonism":0.101973799,
"Self-enhancement":0.1235634015,
"Self-transcendence":0.098292791,
"n":25.8098237833
},
"min":{
"Openness":0.2152542646,
"Conscientousness":0.1085605602,
"Extraversion":0.1022540075,
"Agreeableness":0.017733368,
"Emotional_Range":0.165238157,
"Conversation":0.0124883557,
"Openness to Change":0.1470387283,
"Hedonism":0.0290857203,
"Self-enhancement":0.0298680791,
"Self-transcendence":0.0353641396,
"n":50.0
},
"25%":{
"Openness":0.6159645036,
"Conscientousness":0.453015216,
"Extraversion":0.5015413749,
"Agreeableness":0.1927662685,
"Emotional_Range":0.5281815531,
"Conversation":0.1087056755,
"Openness to Change":0.3720593776,
"Hedonism":0.1141935636,
"Self-enhancement":0.2732188024,
"Self-transcendence":0.2014597353,
"n":72.0
},
"50%":{
"Openness":0.6877670374,
"Conscientousness":0.5529477526,
"Extraversion":0.6337253665,
"Agreeableness":0.3236347592,
"Emotional_Range":0.6168124863,
"Conversation":0.1734567056,
"Openness to Change":0.430397799,
"Hedonism":0.158430861,
"Self-enhancement":0.3399782773,
"Self-transcendence":0.2556183242,
"n":76.0
},
"75%":{
"Openness":0.7561884082,
"Conscientousness":0.6510142733,
"Extraversion":0.7274713099,
"Agreeableness":0.4492181284,
"Emotional_Range":0.7010886899,
"Conversation":0.2547882803,
"Openness to Change":0.4846609371,
"Hedonism":0.2265744616,
"Self-enhancement":0.4299178279,
"Self-transcendence":0.3220190548,
"n":80.0
},
"max":{
"Openness":0.95992792,
"Conscientousness":0.960118167,
"Extraversion":0.9794365923,
"Agreeableness":0.8993661095,
"Emotional_Range":0.9415769334,
"Conversation":0.7793932512,
"Openness to Change":0.7557249986,
"Hedonism":0.680102991,
"Self-enhancement":0.7826336181,
"Self-transcendence":0.6273682888,
"n":313.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 the average level of Openness to Change higher than the average level of Hedonism?
# 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 the average level of Openness to Change higher than the average level of Hedonism?
df.columns = ['Profession', 'Openness', 'Conscientousness', 'Extraversion', 'Agreeableness', 'Emotional_Range', 'Conversation', 'Openness to Change', 'Hedonism', 'Self-enhancement', 'Self-transcendence', 'n']
# Expected output type: is boolean, this will be checked.
return | 20250129013715 |
44 | What is the maximum value of Self-enhancement across all professions? | 052_Professional | dev | number | ['Self-enhancement'] | 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": "Profession",
"type": "category"
},
{
"name": "Openness",
"type": "float64"
},
{
"name": "Conscientousness",
"type": "float64"
},
{
"name": "Extraversion",
"type": "float64"
},
{
"name": "Agreeableness",
"type": "float64"
},
{
"name": "Emotional_Range",
"type": "float64"
},
{
"name": "Conversation",
"type": "float64"
},
{
"name": "Openness to Change",
"type": "float64"
},
{
"name": "Hedonism",
"type": "float64"
},
{
"name": "Self-enhancement",
"type": "float64"
},
{
"name": "Self-transcendence",
"type": "float64"
},
{
"name": "n",
"type": "uint16"
}
]
}
# Description of dataframe columns.
df_descrption = {
"count":{
"Openness":1227.0,
"Conscientousness":1227.0,
"Extraversion":1227.0,
"Agreeableness":1227.0,
"Emotional_Range":1227.0,
"Conversation":1227.0,
"Openness to Change":1227.0,
"Hedonism":1227.0,
"Self-enhancement":1227.0,
"Self-transcendence":1227.0,
"n":1227.0
},
"mean":{
"Openness":0.6818599599,
"Conscientousness":0.5494864934,
"Extraversion":0.5999407609,
"Agreeableness":0.3300650815,
"Emotional_Range":0.6150157566,
"Conversation":0.1954283756,
"Openness to Change":0.4297269623,
"Hedonism":0.1854087597,
"Self-enhancement":0.3530469421,
"Self-transcendence":0.2674535075,
"n":82.4392828036
},
"std":{
"Openness":0.1062055359,
"Conscientousness":0.1504663216,
"Extraversion":0.1730540692,
"Agreeableness":0.1775762646,
"Emotional_Range":0.1320494061,
"Conversation":0.1168313736,
"Openness to Change":0.0884607635,
"Hedonism":0.101973799,
"Self-enhancement":0.1235634015,
"Self-transcendence":0.098292791,
"n":25.8098237833
},
"min":{
"Openness":0.2152542646,
"Conscientousness":0.1085605602,
"Extraversion":0.1022540075,
"Agreeableness":0.017733368,
"Emotional_Range":0.165238157,
"Conversation":0.0124883557,
"Openness to Change":0.1470387283,
"Hedonism":0.0290857203,
"Self-enhancement":0.0298680791,
"Self-transcendence":0.0353641396,
"n":50.0
},
"25%":{
"Openness":0.6159645036,
"Conscientousness":0.453015216,
"Extraversion":0.5015413749,
"Agreeableness":0.1927662685,
"Emotional_Range":0.5281815531,
"Conversation":0.1087056755,
"Openness to Change":0.3720593776,
"Hedonism":0.1141935636,
"Self-enhancement":0.2732188024,
"Self-transcendence":0.2014597353,
"n":72.0
},
"50%":{
"Openness":0.6877670374,
"Conscientousness":0.5529477526,
"Extraversion":0.6337253665,
"Agreeableness":0.3236347592,
"Emotional_Range":0.6168124863,
"Conversation":0.1734567056,
"Openness to Change":0.430397799,
"Hedonism":0.158430861,
"Self-enhancement":0.3399782773,
"Self-transcendence":0.2556183242,
"n":76.0
},
"75%":{
"Openness":0.7561884082,
"Conscientousness":0.6510142733,
"Extraversion":0.7274713099,
"Agreeableness":0.4492181284,
"Emotional_Range":0.7010886899,
"Conversation":0.2547882803,
"Openness to Change":0.4846609371,
"Hedonism":0.2265744616,
"Self-enhancement":0.4299178279,
"Self-transcendence":0.3220190548,
"n":80.0
},
"max":{
"Openness":0.95992792,
"Conscientousness":0.960118167,
"Extraversion":0.9794365923,
"Agreeableness":0.8993661095,
"Emotional_Range":0.9415769334,
"Conversation":0.7793932512,
"Openness to Change":0.7557249986,
"Hedonism":0.680102991,
"Self-enhancement":0.7826336181,
"Self-transcendence":0.6273682888,
"n":313.0
}
}
# Randome sample of 10 rows from the dataframe.
df_random_sample = {
"count":{
"Openness":1227.0,
"Conscientousness":1227.0,
"Extraversion":1227.0,
"Agreeableness":1227.0,
"Emotional_Range":1227.0,
"Conversation":1227.0,
"Openness to Change":1227.0,
"Hedonism":1227.0,
"Self-enhancement":1227.0,
"Self-transcendence":1227.0,
"n":1227.0
},
"mean":{
"Openness":0.6818599599,
"Conscientousness":0.5494864934,
"Extraversion":0.5999407609,
"Agreeableness":0.3300650815,
"Emotional_Range":0.6150157566,
"Conversation":0.1954283756,
"Openness to Change":0.4297269623,
"Hedonism":0.1854087597,
"Self-enhancement":0.3530469421,
"Self-transcendence":0.2674535075,
"n":82.4392828036
},
"std":{
"Openness":0.1062055359,
"Conscientousness":0.1504663216,
"Extraversion":0.1730540692,
"Agreeableness":0.1775762646,
"Emotional_Range":0.1320494061,
"Conversation":0.1168313736,
"Openness to Change":0.0884607635,
"Hedonism":0.101973799,
"Self-enhancement":0.1235634015,
"Self-transcendence":0.098292791,
"n":25.8098237833
},
"min":{
"Openness":0.2152542646,
"Conscientousness":0.1085605602,
"Extraversion":0.1022540075,
"Agreeableness":0.017733368,
"Emotional_Range":0.165238157,
"Conversation":0.0124883557,
"Openness to Change":0.1470387283,
"Hedonism":0.0290857203,
"Self-enhancement":0.0298680791,
"Self-transcendence":0.0353641396,
"n":50.0
},
"25%":{
"Openness":0.6159645036,
"Conscientousness":0.453015216,
"Extraversion":0.5015413749,
"Agreeableness":0.1927662685,
"Emotional_Range":0.5281815531,
"Conversation":0.1087056755,
"Openness to Change":0.3720593776,
"Hedonism":0.1141935636,
"Self-enhancement":0.2732188024,
"Self-transcendence":0.2014597353,
"n":72.0
},
"50%":{
"Openness":0.6877670374,
"Conscientousness":0.5529477526,
"Extraversion":0.6337253665,
"Agreeableness":0.3236347592,
"Emotional_Range":0.6168124863,
"Conversation":0.1734567056,
"Openness to Change":0.430397799,
"Hedonism":0.158430861,
"Self-enhancement":0.3399782773,
"Self-transcendence":0.2556183242,
"n":76.0
},
"75%":{
"Openness":0.7561884082,
"Conscientousness":0.6510142733,
"Extraversion":0.7274713099,
"Agreeableness":0.4492181284,
"Emotional_Range":0.7010886899,
"Conversation":0.2547882803,
"Openness to Change":0.4846609371,
"Hedonism":0.2265744616,
"Self-enhancement":0.4299178279,
"Self-transcendence":0.3220190548,
"n":80.0
},
"max":{
"Openness":0.95992792,
"Conscientousness":0.960118167,
"Extraversion":0.9794365923,
"Agreeableness":0.8993661095,
"Emotional_Range":0.9415769334,
"Conversation":0.7793932512,
"Openness to Change":0.7557249986,
"Hedonism":0.680102991,
"Self-enhancement":0.7826336181,
"Self-transcendence":0.6273682888,
"n":313.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 value of Self-enhancement across all professions?
# 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 value of Self-enhancement across all professions?
df.columns = ['Profession', 'Openness', 'Conscientousness', 'Extraversion', 'Agreeableness', 'Emotional_Range', 'Conversation', 'Openness to Change', 'Hedonism', 'Self-enhancement', 'Self-transcendence', 'n']
# Expected output type: is number, this will be checked.
return | 20250129013715 |
45 | How many professions have an Emotional_Range above 0.5? | 052_Professional | dev | number | ['Emotional_Range'] | 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": "Profession",
"type": "category"
},
{
"name": "Openness",
"type": "float64"
},
{
"name": "Conscientousness",
"type": "float64"
},
{
"name": "Extraversion",
"type": "float64"
},
{
"name": "Agreeableness",
"type": "float64"
},
{
"name": "Emotional_Range",
"type": "float64"
},
{
"name": "Conversation",
"type": "float64"
},
{
"name": "Openness to Change",
"type": "float64"
},
{
"name": "Hedonism",
"type": "float64"
},
{
"name": "Self-enhancement",
"type": "float64"
},
{
"name": "Self-transcendence",
"type": "float64"
},
{
"name": "n",
"type": "uint16"
}
]
}
# Description of dataframe columns.
df_descrption = {
"count":{
"Openness":1227.0,
"Conscientousness":1227.0,
"Extraversion":1227.0,
"Agreeableness":1227.0,
"Emotional_Range":1227.0,
"Conversation":1227.0,
"Openness to Change":1227.0,
"Hedonism":1227.0,
"Self-enhancement":1227.0,
"Self-transcendence":1227.0,
"n":1227.0
},
"mean":{
"Openness":0.6818599599,
"Conscientousness":0.5494864934,
"Extraversion":0.5999407609,
"Agreeableness":0.3300650815,
"Emotional_Range":0.6150157566,
"Conversation":0.1954283756,
"Openness to Change":0.4297269623,
"Hedonism":0.1854087597,
"Self-enhancement":0.3530469421,
"Self-transcendence":0.2674535075,
"n":82.4392828036
},
"std":{
"Openness":0.1062055359,
"Conscientousness":0.1504663216,
"Extraversion":0.1730540692,
"Agreeableness":0.1775762646,
"Emotional_Range":0.1320494061,
"Conversation":0.1168313736,
"Openness to Change":0.0884607635,
"Hedonism":0.101973799,
"Self-enhancement":0.1235634015,
"Self-transcendence":0.098292791,
"n":25.8098237833
},
"min":{
"Openness":0.2152542646,
"Conscientousness":0.1085605602,
"Extraversion":0.1022540075,
"Agreeableness":0.017733368,
"Emotional_Range":0.165238157,
"Conversation":0.0124883557,
"Openness to Change":0.1470387283,
"Hedonism":0.0290857203,
"Self-enhancement":0.0298680791,
"Self-transcendence":0.0353641396,
"n":50.0
},
"25%":{
"Openness":0.6159645036,
"Conscientousness":0.453015216,
"Extraversion":0.5015413749,
"Agreeableness":0.1927662685,
"Emotional_Range":0.5281815531,
"Conversation":0.1087056755,
"Openness to Change":0.3720593776,
"Hedonism":0.1141935636,
"Self-enhancement":0.2732188024,
"Self-transcendence":0.2014597353,
"n":72.0
},
"50%":{
"Openness":0.6877670374,
"Conscientousness":0.5529477526,
"Extraversion":0.6337253665,
"Agreeableness":0.3236347592,
"Emotional_Range":0.6168124863,
"Conversation":0.1734567056,
"Openness to Change":0.430397799,
"Hedonism":0.158430861,
"Self-enhancement":0.3399782773,
"Self-transcendence":0.2556183242,
"n":76.0
},
"75%":{
"Openness":0.7561884082,
"Conscientousness":0.6510142733,
"Extraversion":0.7274713099,
"Agreeableness":0.4492181284,
"Emotional_Range":0.7010886899,
"Conversation":0.2547882803,
"Openness to Change":0.4846609371,
"Hedonism":0.2265744616,
"Self-enhancement":0.4299178279,
"Self-transcendence":0.3220190548,
"n":80.0
},
"max":{
"Openness":0.95992792,
"Conscientousness":0.960118167,
"Extraversion":0.9794365923,
"Agreeableness":0.8993661095,
"Emotional_Range":0.9415769334,
"Conversation":0.7793932512,
"Openness to Change":0.7557249986,
"Hedonism":0.680102991,
"Self-enhancement":0.7826336181,
"Self-transcendence":0.6273682888,
"n":313.0
}
}
# Randome sample of 10 rows from the dataframe.
df_random_sample = {
"count":{
"Openness":1227.0,
"Conscientousness":1227.0,
"Extraversion":1227.0,
"Agreeableness":1227.0,
"Emotional_Range":1227.0,
"Conversation":1227.0,
"Openness to Change":1227.0,
"Hedonism":1227.0,
"Self-enhancement":1227.0,
"Self-transcendence":1227.0,
"n":1227.0
},
"mean":{
"Openness":0.6818599599,
"Conscientousness":0.5494864934,
"Extraversion":0.5999407609,
"Agreeableness":0.3300650815,
"Emotional_Range":0.6150157566,
"Conversation":0.1954283756,
"Openness to Change":0.4297269623,
"Hedonism":0.1854087597,
"Self-enhancement":0.3530469421,
"Self-transcendence":0.2674535075,
"n":82.4392828036
},
"std":{
"Openness":0.1062055359,
"Conscientousness":0.1504663216,
"Extraversion":0.1730540692,
"Agreeableness":0.1775762646,
"Emotional_Range":0.1320494061,
"Conversation":0.1168313736,
"Openness to Change":0.0884607635,
"Hedonism":0.101973799,
"Self-enhancement":0.1235634015,
"Self-transcendence":0.098292791,
"n":25.8098237833
},
"min":{
"Openness":0.2152542646,
"Conscientousness":0.1085605602,
"Extraversion":0.1022540075,
"Agreeableness":0.017733368,
"Emotional_Range":0.165238157,
"Conversation":0.0124883557,
"Openness to Change":0.1470387283,
"Hedonism":0.0290857203,
"Self-enhancement":0.0298680791,
"Self-transcendence":0.0353641396,
"n":50.0
},
"25%":{
"Openness":0.6159645036,
"Conscientousness":0.453015216,
"Extraversion":0.5015413749,
"Agreeableness":0.1927662685,
"Emotional_Range":0.5281815531,
"Conversation":0.1087056755,
"Openness to Change":0.3720593776,
"Hedonism":0.1141935636,
"Self-enhancement":0.2732188024,
"Self-transcendence":0.2014597353,
"n":72.0
},
"50%":{
"Openness":0.6877670374,
"Conscientousness":0.5529477526,
"Extraversion":0.6337253665,
"Agreeableness":0.3236347592,
"Emotional_Range":0.6168124863,
"Conversation":0.1734567056,
"Openness to Change":0.430397799,
"Hedonism":0.158430861,
"Self-enhancement":0.3399782773,
"Self-transcendence":0.2556183242,
"n":76.0
},
"75%":{
"Openness":0.7561884082,
"Conscientousness":0.6510142733,
"Extraversion":0.7274713099,
"Agreeableness":0.4492181284,
"Emotional_Range":0.7010886899,
"Conversation":0.2547882803,
"Openness to Change":0.4846609371,
"Hedonism":0.2265744616,
"Self-enhancement":0.4299178279,
"Self-transcendence":0.3220190548,
"n":80.0
},
"max":{
"Openness":0.95992792,
"Conscientousness":0.960118167,
"Extraversion":0.9794365923,
"Agreeableness":0.8993661095,
"Emotional_Range":0.9415769334,
"Conversation":0.7793932512,
"Openness to Change":0.7557249986,
"Hedonism":0.680102991,
"Self-enhancement":0.7826336181,
"Self-transcendence":0.6273682888,
"n":313.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 professions have an Emotional_Range above 0.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: How many professions have an Emotional_Range above 0.5?
df.columns = ['Profession', 'Openness', 'Conscientousness', 'Extraversion', 'Agreeableness', 'Emotional_Range', 'Conversation', 'Openness to Change', 'Hedonism', 'Self-enhancement', 'Self-transcendence', 'n']
# Expected output type: is number, this will be checked.
return | 20250129013715 |
46 | What is the average Extraversion level for the profession with the highest number of records (n)? | 052_Professional | dev | number | ['Profession', 'Extraversion', 'n'] | 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": "Profession",
"type": "category"
},
{
"name": "Openness",
"type": "float64"
},
{
"name": "Conscientousness",
"type": "float64"
},
{
"name": "Extraversion",
"type": "float64"
},
{
"name": "Agreeableness",
"type": "float64"
},
{
"name": "Emotional_Range",
"type": "float64"
},
{
"name": "Conversation",
"type": "float64"
},
{
"name": "Openness to Change",
"type": "float64"
},
{
"name": "Hedonism",
"type": "float64"
},
{
"name": "Self-enhancement",
"type": "float64"
},
{
"name": "Self-transcendence",
"type": "float64"
},
{
"name": "n",
"type": "uint16"
}
]
}
# Description of dataframe columns.
df_descrption = {
"count":{
"Openness":1227.0,
"Conscientousness":1227.0,
"Extraversion":1227.0,
"Agreeableness":1227.0,
"Emotional_Range":1227.0,
"Conversation":1227.0,
"Openness to Change":1227.0,
"Hedonism":1227.0,
"Self-enhancement":1227.0,
"Self-transcendence":1227.0,
"n":1227.0
},
"mean":{
"Openness":0.6818599599,
"Conscientousness":0.5494864934,
"Extraversion":0.5999407609,
"Agreeableness":0.3300650815,
"Emotional_Range":0.6150157566,
"Conversation":0.1954283756,
"Openness to Change":0.4297269623,
"Hedonism":0.1854087597,
"Self-enhancement":0.3530469421,
"Self-transcendence":0.2674535075,
"n":82.4392828036
},
"std":{
"Openness":0.1062055359,
"Conscientousness":0.1504663216,
"Extraversion":0.1730540692,
"Agreeableness":0.1775762646,
"Emotional_Range":0.1320494061,
"Conversation":0.1168313736,
"Openness to Change":0.0884607635,
"Hedonism":0.101973799,
"Self-enhancement":0.1235634015,
"Self-transcendence":0.098292791,
"n":25.8098237833
},
"min":{
"Openness":0.2152542646,
"Conscientousness":0.1085605602,
"Extraversion":0.1022540075,
"Agreeableness":0.017733368,
"Emotional_Range":0.165238157,
"Conversation":0.0124883557,
"Openness to Change":0.1470387283,
"Hedonism":0.0290857203,
"Self-enhancement":0.0298680791,
"Self-transcendence":0.0353641396,
"n":50.0
},
"25%":{
"Openness":0.6159645036,
"Conscientousness":0.453015216,
"Extraversion":0.5015413749,
"Agreeableness":0.1927662685,
"Emotional_Range":0.5281815531,
"Conversation":0.1087056755,
"Openness to Change":0.3720593776,
"Hedonism":0.1141935636,
"Self-enhancement":0.2732188024,
"Self-transcendence":0.2014597353,
"n":72.0
},
"50%":{
"Openness":0.6877670374,
"Conscientousness":0.5529477526,
"Extraversion":0.6337253665,
"Agreeableness":0.3236347592,
"Emotional_Range":0.6168124863,
"Conversation":0.1734567056,
"Openness to Change":0.430397799,
"Hedonism":0.158430861,
"Self-enhancement":0.3399782773,
"Self-transcendence":0.2556183242,
"n":76.0
},
"75%":{
"Openness":0.7561884082,
"Conscientousness":0.6510142733,
"Extraversion":0.7274713099,
"Agreeableness":0.4492181284,
"Emotional_Range":0.7010886899,
"Conversation":0.2547882803,
"Openness to Change":0.4846609371,
"Hedonism":0.2265744616,
"Self-enhancement":0.4299178279,
"Self-transcendence":0.3220190548,
"n":80.0
},
"max":{
"Openness":0.95992792,
"Conscientousness":0.960118167,
"Extraversion":0.9794365923,
"Agreeableness":0.8993661095,
"Emotional_Range":0.9415769334,
"Conversation":0.7793932512,
"Openness to Change":0.7557249986,
"Hedonism":0.680102991,
"Self-enhancement":0.7826336181,
"Self-transcendence":0.6273682888,
"n":313.0
}
}
# Randome sample of 10 rows from the dataframe.
df_random_sample = {
"count":{
"Openness":1227.0,
"Conscientousness":1227.0,
"Extraversion":1227.0,
"Agreeableness":1227.0,
"Emotional_Range":1227.0,
"Conversation":1227.0,
"Openness to Change":1227.0,
"Hedonism":1227.0,
"Self-enhancement":1227.0,
"Self-transcendence":1227.0,
"n":1227.0
},
"mean":{
"Openness":0.6818599599,
"Conscientousness":0.5494864934,
"Extraversion":0.5999407609,
"Agreeableness":0.3300650815,
"Emotional_Range":0.6150157566,
"Conversation":0.1954283756,
"Openness to Change":0.4297269623,
"Hedonism":0.1854087597,
"Self-enhancement":0.3530469421,
"Self-transcendence":0.2674535075,
"n":82.4392828036
},
"std":{
"Openness":0.1062055359,
"Conscientousness":0.1504663216,
"Extraversion":0.1730540692,
"Agreeableness":0.1775762646,
"Emotional_Range":0.1320494061,
"Conversation":0.1168313736,
"Openness to Change":0.0884607635,
"Hedonism":0.101973799,
"Self-enhancement":0.1235634015,
"Self-transcendence":0.098292791,
"n":25.8098237833
},
"min":{
"Openness":0.2152542646,
"Conscientousness":0.1085605602,
"Extraversion":0.1022540075,
"Agreeableness":0.017733368,
"Emotional_Range":0.165238157,
"Conversation":0.0124883557,
"Openness to Change":0.1470387283,
"Hedonism":0.0290857203,
"Self-enhancement":0.0298680791,
"Self-transcendence":0.0353641396,
"n":50.0
},
"25%":{
"Openness":0.6159645036,
"Conscientousness":0.453015216,
"Extraversion":0.5015413749,
"Agreeableness":0.1927662685,
"Emotional_Range":0.5281815531,
"Conversation":0.1087056755,
"Openness to Change":0.3720593776,
"Hedonism":0.1141935636,
"Self-enhancement":0.2732188024,
"Self-transcendence":0.2014597353,
"n":72.0
},
"50%":{
"Openness":0.6877670374,
"Conscientousness":0.5529477526,
"Extraversion":0.6337253665,
"Agreeableness":0.3236347592,
"Emotional_Range":0.6168124863,
"Conversation":0.1734567056,
"Openness to Change":0.430397799,
"Hedonism":0.158430861,
"Self-enhancement":0.3399782773,
"Self-transcendence":0.2556183242,
"n":76.0
},
"75%":{
"Openness":0.7561884082,
"Conscientousness":0.6510142733,
"Extraversion":0.7274713099,
"Agreeableness":0.4492181284,
"Emotional_Range":0.7010886899,
"Conversation":0.2547882803,
"Openness to Change":0.4846609371,
"Hedonism":0.2265744616,
"Self-enhancement":0.4299178279,
"Self-transcendence":0.3220190548,
"n":80.0
},
"max":{
"Openness":0.95992792,
"Conscientousness":0.960118167,
"Extraversion":0.9794365923,
"Agreeableness":0.8993661095,
"Emotional_Range":0.9415769334,
"Conversation":0.7793932512,
"Openness to Change":0.7557249986,
"Hedonism":0.680102991,
"Self-enhancement":0.7826336181,
"Self-transcendence":0.6273682888,
"n":313.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 Extraversion level for the profession with the highest number of records (n)?
# 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 Extraversion level for the profession with the highest number of records (n)?
df.columns = ['Profession', 'Openness', 'Conscientousness', 'Extraversion', 'Agreeableness', 'Emotional_Range', 'Conversation', 'Openness to Change', 'Hedonism', 'Self-enhancement', 'Self-transcendence', 'n']
# Expected output type: is number, this will be checked.
return | 20250129013715 |
47 | What is the minimum level of Self-transcendence? | 052_Professional | dev | number | ['Self-transcendence'] | 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": "Profession",
"type": "category"
},
{
"name": "Openness",
"type": "float64"
},
{
"name": "Conscientousness",
"type": "float64"
},
{
"name": "Extraversion",
"type": "float64"
},
{
"name": "Agreeableness",
"type": "float64"
},
{
"name": "Emotional_Range",
"type": "float64"
},
{
"name": "Conversation",
"type": "float64"
},
{
"name": "Openness to Change",
"type": "float64"
},
{
"name": "Hedonism",
"type": "float64"
},
{
"name": "Self-enhancement",
"type": "float64"
},
{
"name": "Self-transcendence",
"type": "float64"
},
{
"name": "n",
"type": "uint16"
}
]
}
# Description of dataframe columns.
df_descrption = {
"count":{
"Openness":1227.0,
"Conscientousness":1227.0,
"Extraversion":1227.0,
"Agreeableness":1227.0,
"Emotional_Range":1227.0,
"Conversation":1227.0,
"Openness to Change":1227.0,
"Hedonism":1227.0,
"Self-enhancement":1227.0,
"Self-transcendence":1227.0,
"n":1227.0
},
"mean":{
"Openness":0.6818599599,
"Conscientousness":0.5494864934,
"Extraversion":0.5999407609,
"Agreeableness":0.3300650815,
"Emotional_Range":0.6150157566,
"Conversation":0.1954283756,
"Openness to Change":0.4297269623,
"Hedonism":0.1854087597,
"Self-enhancement":0.3530469421,
"Self-transcendence":0.2674535075,
"n":82.4392828036
},
"std":{
"Openness":0.1062055359,
"Conscientousness":0.1504663216,
"Extraversion":0.1730540692,
"Agreeableness":0.1775762646,
"Emotional_Range":0.1320494061,
"Conversation":0.1168313736,
"Openness to Change":0.0884607635,
"Hedonism":0.101973799,
"Self-enhancement":0.1235634015,
"Self-transcendence":0.098292791,
"n":25.8098237833
},
"min":{
"Openness":0.2152542646,
"Conscientousness":0.1085605602,
"Extraversion":0.1022540075,
"Agreeableness":0.017733368,
"Emotional_Range":0.165238157,
"Conversation":0.0124883557,
"Openness to Change":0.1470387283,
"Hedonism":0.0290857203,
"Self-enhancement":0.0298680791,
"Self-transcendence":0.0353641396,
"n":50.0
},
"25%":{
"Openness":0.6159645036,
"Conscientousness":0.453015216,
"Extraversion":0.5015413749,
"Agreeableness":0.1927662685,
"Emotional_Range":0.5281815531,
"Conversation":0.1087056755,
"Openness to Change":0.3720593776,
"Hedonism":0.1141935636,
"Self-enhancement":0.2732188024,
"Self-transcendence":0.2014597353,
"n":72.0
},
"50%":{
"Openness":0.6877670374,
"Conscientousness":0.5529477526,
"Extraversion":0.6337253665,
"Agreeableness":0.3236347592,
"Emotional_Range":0.6168124863,
"Conversation":0.1734567056,
"Openness to Change":0.430397799,
"Hedonism":0.158430861,
"Self-enhancement":0.3399782773,
"Self-transcendence":0.2556183242,
"n":76.0
},
"75%":{
"Openness":0.7561884082,
"Conscientousness":0.6510142733,
"Extraversion":0.7274713099,
"Agreeableness":0.4492181284,
"Emotional_Range":0.7010886899,
"Conversation":0.2547882803,
"Openness to Change":0.4846609371,
"Hedonism":0.2265744616,
"Self-enhancement":0.4299178279,
"Self-transcendence":0.3220190548,
"n":80.0
},
"max":{
"Openness":0.95992792,
"Conscientousness":0.960118167,
"Extraversion":0.9794365923,
"Agreeableness":0.8993661095,
"Emotional_Range":0.9415769334,
"Conversation":0.7793932512,
"Openness to Change":0.7557249986,
"Hedonism":0.680102991,
"Self-enhancement":0.7826336181,
"Self-transcendence":0.6273682888,
"n":313.0
}
}
# Randome sample of 10 rows from the dataframe.
df_random_sample = {
"count":{
"Openness":1227.0,
"Conscientousness":1227.0,
"Extraversion":1227.0,
"Agreeableness":1227.0,
"Emotional_Range":1227.0,
"Conversation":1227.0,
"Openness to Change":1227.0,
"Hedonism":1227.0,
"Self-enhancement":1227.0,
"Self-transcendence":1227.0,
"n":1227.0
},
"mean":{
"Openness":0.6818599599,
"Conscientousness":0.5494864934,
"Extraversion":0.5999407609,
"Agreeableness":0.3300650815,
"Emotional_Range":0.6150157566,
"Conversation":0.1954283756,
"Openness to Change":0.4297269623,
"Hedonism":0.1854087597,
"Self-enhancement":0.3530469421,
"Self-transcendence":0.2674535075,
"n":82.4392828036
},
"std":{
"Openness":0.1062055359,
"Conscientousness":0.1504663216,
"Extraversion":0.1730540692,
"Agreeableness":0.1775762646,
"Emotional_Range":0.1320494061,
"Conversation":0.1168313736,
"Openness to Change":0.0884607635,
"Hedonism":0.101973799,
"Self-enhancement":0.1235634015,
"Self-transcendence":0.098292791,
"n":25.8098237833
},
"min":{
"Openness":0.2152542646,
"Conscientousness":0.1085605602,
"Extraversion":0.1022540075,
"Agreeableness":0.017733368,
"Emotional_Range":0.165238157,
"Conversation":0.0124883557,
"Openness to Change":0.1470387283,
"Hedonism":0.0290857203,
"Self-enhancement":0.0298680791,
"Self-transcendence":0.0353641396,
"n":50.0
},
"25%":{
"Openness":0.6159645036,
"Conscientousness":0.453015216,
"Extraversion":0.5015413749,
"Agreeableness":0.1927662685,
"Emotional_Range":0.5281815531,
"Conversation":0.1087056755,
"Openness to Change":0.3720593776,
"Hedonism":0.1141935636,
"Self-enhancement":0.2732188024,
"Self-transcendence":0.2014597353,
"n":72.0
},
"50%":{
"Openness":0.6877670374,
"Conscientousness":0.5529477526,
"Extraversion":0.6337253665,
"Agreeableness":0.3236347592,
"Emotional_Range":0.6168124863,
"Conversation":0.1734567056,
"Openness to Change":0.430397799,
"Hedonism":0.158430861,
"Self-enhancement":0.3399782773,
"Self-transcendence":0.2556183242,
"n":76.0
},
"75%":{
"Openness":0.7561884082,
"Conscientousness":0.6510142733,
"Extraversion":0.7274713099,
"Agreeableness":0.4492181284,
"Emotional_Range":0.7010886899,
"Conversation":0.2547882803,
"Openness to Change":0.4846609371,
"Hedonism":0.2265744616,
"Self-enhancement":0.4299178279,
"Self-transcendence":0.3220190548,
"n":80.0
},
"max":{
"Openness":0.95992792,
"Conscientousness":0.960118167,
"Extraversion":0.9794365923,
"Agreeableness":0.8993661095,
"Emotional_Range":0.9415769334,
"Conversation":0.7793932512,
"Openness to Change":0.7557249986,
"Hedonism":0.680102991,
"Self-enhancement":0.7826336181,
"Self-transcendence":0.6273682888,
"n":313.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 minimum level of Self-transcendence?
# 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 minimum level of Self-transcendence?
df.columns = ['Profession', 'Openness', 'Conscientousness', 'Extraversion', 'Agreeableness', 'Emotional_Range', 'Conversation', 'Openness to Change', 'Hedonism', 'Self-enhancement', 'Self-transcendence', 'n']
# Expected output type: is number, this will be checked.
return | 20250129013715 |
48 | What profession has the highest level of Conscientiousness? | 052_Professional | dev | category | ['Profession', 'Conscientousness'] | 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": "Profession",
"type": "category"
},
{
"name": "Openness",
"type": "float64"
},
{
"name": "Conscientousness",
"type": "float64"
},
{
"name": "Extraversion",
"type": "float64"
},
{
"name": "Agreeableness",
"type": "float64"
},
{
"name": "Emotional_Range",
"type": "float64"
},
{
"name": "Conversation",
"type": "float64"
},
{
"name": "Openness to Change",
"type": "float64"
},
{
"name": "Hedonism",
"type": "float64"
},
{
"name": "Self-enhancement",
"type": "float64"
},
{
"name": "Self-transcendence",
"type": "float64"
},
{
"name": "n",
"type": "uint16"
}
]
}
# Description of dataframe columns.
df_descrption = {
"count":{
"Openness":1227.0,
"Conscientousness":1227.0,
"Extraversion":1227.0,
"Agreeableness":1227.0,
"Emotional_Range":1227.0,
"Conversation":1227.0,
"Openness to Change":1227.0,
"Hedonism":1227.0,
"Self-enhancement":1227.0,
"Self-transcendence":1227.0,
"n":1227.0
},
"mean":{
"Openness":0.6818599599,
"Conscientousness":0.5494864934,
"Extraversion":0.5999407609,
"Agreeableness":0.3300650815,
"Emotional_Range":0.6150157566,
"Conversation":0.1954283756,
"Openness to Change":0.4297269623,
"Hedonism":0.1854087597,
"Self-enhancement":0.3530469421,
"Self-transcendence":0.2674535075,
"n":82.4392828036
},
"std":{
"Openness":0.1062055359,
"Conscientousness":0.1504663216,
"Extraversion":0.1730540692,
"Agreeableness":0.1775762646,
"Emotional_Range":0.1320494061,
"Conversation":0.1168313736,
"Openness to Change":0.0884607635,
"Hedonism":0.101973799,
"Self-enhancement":0.1235634015,
"Self-transcendence":0.098292791,
"n":25.8098237833
},
"min":{
"Openness":0.2152542646,
"Conscientousness":0.1085605602,
"Extraversion":0.1022540075,
"Agreeableness":0.017733368,
"Emotional_Range":0.165238157,
"Conversation":0.0124883557,
"Openness to Change":0.1470387283,
"Hedonism":0.0290857203,
"Self-enhancement":0.0298680791,
"Self-transcendence":0.0353641396,
"n":50.0
},
"25%":{
"Openness":0.6159645036,
"Conscientousness":0.453015216,
"Extraversion":0.5015413749,
"Agreeableness":0.1927662685,
"Emotional_Range":0.5281815531,
"Conversation":0.1087056755,
"Openness to Change":0.3720593776,
"Hedonism":0.1141935636,
"Self-enhancement":0.2732188024,
"Self-transcendence":0.2014597353,
"n":72.0
},
"50%":{
"Openness":0.6877670374,
"Conscientousness":0.5529477526,
"Extraversion":0.6337253665,
"Agreeableness":0.3236347592,
"Emotional_Range":0.6168124863,
"Conversation":0.1734567056,
"Openness to Change":0.430397799,
"Hedonism":0.158430861,
"Self-enhancement":0.3399782773,
"Self-transcendence":0.2556183242,
"n":76.0
},
"75%":{
"Openness":0.7561884082,
"Conscientousness":0.6510142733,
"Extraversion":0.7274713099,
"Agreeableness":0.4492181284,
"Emotional_Range":0.7010886899,
"Conversation":0.2547882803,
"Openness to Change":0.4846609371,
"Hedonism":0.2265744616,
"Self-enhancement":0.4299178279,
"Self-transcendence":0.3220190548,
"n":80.0
},
"max":{
"Openness":0.95992792,
"Conscientousness":0.960118167,
"Extraversion":0.9794365923,
"Agreeableness":0.8993661095,
"Emotional_Range":0.9415769334,
"Conversation":0.7793932512,
"Openness to Change":0.7557249986,
"Hedonism":0.680102991,
"Self-enhancement":0.7826336181,
"Self-transcendence":0.6273682888,
"n":313.0
}
}
# Randome sample of 10 rows from the dataframe.
df_random_sample = {
"count":{
"Openness":1227.0,
"Conscientousness":1227.0,
"Extraversion":1227.0,
"Agreeableness":1227.0,
"Emotional_Range":1227.0,
"Conversation":1227.0,
"Openness to Change":1227.0,
"Hedonism":1227.0,
"Self-enhancement":1227.0,
"Self-transcendence":1227.0,
"n":1227.0
},
"mean":{
"Openness":0.6818599599,
"Conscientousness":0.5494864934,
"Extraversion":0.5999407609,
"Agreeableness":0.3300650815,
"Emotional_Range":0.6150157566,
"Conversation":0.1954283756,
"Openness to Change":0.4297269623,
"Hedonism":0.1854087597,
"Self-enhancement":0.3530469421,
"Self-transcendence":0.2674535075,
"n":82.4392828036
},
"std":{
"Openness":0.1062055359,
"Conscientousness":0.1504663216,
"Extraversion":0.1730540692,
"Agreeableness":0.1775762646,
"Emotional_Range":0.1320494061,
"Conversation":0.1168313736,
"Openness to Change":0.0884607635,
"Hedonism":0.101973799,
"Self-enhancement":0.1235634015,
"Self-transcendence":0.098292791,
"n":25.8098237833
},
"min":{
"Openness":0.2152542646,
"Conscientousness":0.1085605602,
"Extraversion":0.1022540075,
"Agreeableness":0.017733368,
"Emotional_Range":0.165238157,
"Conversation":0.0124883557,
"Openness to Change":0.1470387283,
"Hedonism":0.0290857203,
"Self-enhancement":0.0298680791,
"Self-transcendence":0.0353641396,
"n":50.0
},
"25%":{
"Openness":0.6159645036,
"Conscientousness":0.453015216,
"Extraversion":0.5015413749,
"Agreeableness":0.1927662685,
"Emotional_Range":0.5281815531,
"Conversation":0.1087056755,
"Openness to Change":0.3720593776,
"Hedonism":0.1141935636,
"Self-enhancement":0.2732188024,
"Self-transcendence":0.2014597353,
"n":72.0
},
"50%":{
"Openness":0.6877670374,
"Conscientousness":0.5529477526,
"Extraversion":0.6337253665,
"Agreeableness":0.3236347592,
"Emotional_Range":0.6168124863,
"Conversation":0.1734567056,
"Openness to Change":0.430397799,
"Hedonism":0.158430861,
"Self-enhancement":0.3399782773,
"Self-transcendence":0.2556183242,
"n":76.0
},
"75%":{
"Openness":0.7561884082,
"Conscientousness":0.6510142733,
"Extraversion":0.7274713099,
"Agreeableness":0.4492181284,
"Emotional_Range":0.7010886899,
"Conversation":0.2547882803,
"Openness to Change":0.4846609371,
"Hedonism":0.2265744616,
"Self-enhancement":0.4299178279,
"Self-transcendence":0.3220190548,
"n":80.0
},
"max":{
"Openness":0.95992792,
"Conscientousness":0.960118167,
"Extraversion":0.9794365923,
"Agreeableness":0.8993661095,
"Emotional_Range":0.9415769334,
"Conversation":0.7793932512,
"Openness to Change":0.7557249986,
"Hedonism":0.680102991,
"Self-enhancement":0.7826336181,
"Self-transcendence":0.6273682888,
"n":313.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 profession has the highest level of Conscientiousness?
# 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 profession has the highest level of Conscientiousness?
df.columns = ['Profession', 'Openness', 'Conscientousness', 'Extraversion', 'Agreeableness', 'Emotional_Range', 'Conversation', 'Openness to Change', 'Hedonism', 'Self-enhancement', 'Self-transcendence', 'n']
# Expected output type: is category, this will be checked.
return | 20250129013715 |
49 | What is the profession with the lowest level of Hedonism? | 052_Professional | dev | category | ['Profession', 'Hedonism'] | 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": "Profession",
"type": "category"
},
{
"name": "Openness",
"type": "float64"
},
{
"name": "Conscientousness",
"type": "float64"
},
{
"name": "Extraversion",
"type": "float64"
},
{
"name": "Agreeableness",
"type": "float64"
},
{
"name": "Emotional_Range",
"type": "float64"
},
{
"name": "Conversation",
"type": "float64"
},
{
"name": "Openness to Change",
"type": "float64"
},
{
"name": "Hedonism",
"type": "float64"
},
{
"name": "Self-enhancement",
"type": "float64"
},
{
"name": "Self-transcendence",
"type": "float64"
},
{
"name": "n",
"type": "uint16"
}
]
}
# Description of dataframe columns.
df_descrption = {
"count":{
"Openness":1227.0,
"Conscientousness":1227.0,
"Extraversion":1227.0,
"Agreeableness":1227.0,
"Emotional_Range":1227.0,
"Conversation":1227.0,
"Openness to Change":1227.0,
"Hedonism":1227.0,
"Self-enhancement":1227.0,
"Self-transcendence":1227.0,
"n":1227.0
},
"mean":{
"Openness":0.6818599599,
"Conscientousness":0.5494864934,
"Extraversion":0.5999407609,
"Agreeableness":0.3300650815,
"Emotional_Range":0.6150157566,
"Conversation":0.1954283756,
"Openness to Change":0.4297269623,
"Hedonism":0.1854087597,
"Self-enhancement":0.3530469421,
"Self-transcendence":0.2674535075,
"n":82.4392828036
},
"std":{
"Openness":0.1062055359,
"Conscientousness":0.1504663216,
"Extraversion":0.1730540692,
"Agreeableness":0.1775762646,
"Emotional_Range":0.1320494061,
"Conversation":0.1168313736,
"Openness to Change":0.0884607635,
"Hedonism":0.101973799,
"Self-enhancement":0.1235634015,
"Self-transcendence":0.098292791,
"n":25.8098237833
},
"min":{
"Openness":0.2152542646,
"Conscientousness":0.1085605602,
"Extraversion":0.1022540075,
"Agreeableness":0.017733368,
"Emotional_Range":0.165238157,
"Conversation":0.0124883557,
"Openness to Change":0.1470387283,
"Hedonism":0.0290857203,
"Self-enhancement":0.0298680791,
"Self-transcendence":0.0353641396,
"n":50.0
},
"25%":{
"Openness":0.6159645036,
"Conscientousness":0.453015216,
"Extraversion":0.5015413749,
"Agreeableness":0.1927662685,
"Emotional_Range":0.5281815531,
"Conversation":0.1087056755,
"Openness to Change":0.3720593776,
"Hedonism":0.1141935636,
"Self-enhancement":0.2732188024,
"Self-transcendence":0.2014597353,
"n":72.0
},
"50%":{
"Openness":0.6877670374,
"Conscientousness":0.5529477526,
"Extraversion":0.6337253665,
"Agreeableness":0.3236347592,
"Emotional_Range":0.6168124863,
"Conversation":0.1734567056,
"Openness to Change":0.430397799,
"Hedonism":0.158430861,
"Self-enhancement":0.3399782773,
"Self-transcendence":0.2556183242,
"n":76.0
},
"75%":{
"Openness":0.7561884082,
"Conscientousness":0.6510142733,
"Extraversion":0.7274713099,
"Agreeableness":0.4492181284,
"Emotional_Range":0.7010886899,
"Conversation":0.2547882803,
"Openness to Change":0.4846609371,
"Hedonism":0.2265744616,
"Self-enhancement":0.4299178279,
"Self-transcendence":0.3220190548,
"n":80.0
},
"max":{
"Openness":0.95992792,
"Conscientousness":0.960118167,
"Extraversion":0.9794365923,
"Agreeableness":0.8993661095,
"Emotional_Range":0.9415769334,
"Conversation":0.7793932512,
"Openness to Change":0.7557249986,
"Hedonism":0.680102991,
"Self-enhancement":0.7826336181,
"Self-transcendence":0.6273682888,
"n":313.0
}
}
# Randome sample of 10 rows from the dataframe.
df_random_sample = {
"count":{
"Openness":1227.0,
"Conscientousness":1227.0,
"Extraversion":1227.0,
"Agreeableness":1227.0,
"Emotional_Range":1227.0,
"Conversation":1227.0,
"Openness to Change":1227.0,
"Hedonism":1227.0,
"Self-enhancement":1227.0,
"Self-transcendence":1227.0,
"n":1227.0
},
"mean":{
"Openness":0.6818599599,
"Conscientousness":0.5494864934,
"Extraversion":0.5999407609,
"Agreeableness":0.3300650815,
"Emotional_Range":0.6150157566,
"Conversation":0.1954283756,
"Openness to Change":0.4297269623,
"Hedonism":0.1854087597,
"Self-enhancement":0.3530469421,
"Self-transcendence":0.2674535075,
"n":82.4392828036
},
"std":{
"Openness":0.1062055359,
"Conscientousness":0.1504663216,
"Extraversion":0.1730540692,
"Agreeableness":0.1775762646,
"Emotional_Range":0.1320494061,
"Conversation":0.1168313736,
"Openness to Change":0.0884607635,
"Hedonism":0.101973799,
"Self-enhancement":0.1235634015,
"Self-transcendence":0.098292791,
"n":25.8098237833
},
"min":{
"Openness":0.2152542646,
"Conscientousness":0.1085605602,
"Extraversion":0.1022540075,
"Agreeableness":0.017733368,
"Emotional_Range":0.165238157,
"Conversation":0.0124883557,
"Openness to Change":0.1470387283,
"Hedonism":0.0290857203,
"Self-enhancement":0.0298680791,
"Self-transcendence":0.0353641396,
"n":50.0
},
"25%":{
"Openness":0.6159645036,
"Conscientousness":0.453015216,
"Extraversion":0.5015413749,
"Agreeableness":0.1927662685,
"Emotional_Range":0.5281815531,
"Conversation":0.1087056755,
"Openness to Change":0.3720593776,
"Hedonism":0.1141935636,
"Self-enhancement":0.2732188024,
"Self-transcendence":0.2014597353,
"n":72.0
},
"50%":{
"Openness":0.6877670374,
"Conscientousness":0.5529477526,
"Extraversion":0.6337253665,
"Agreeableness":0.3236347592,
"Emotional_Range":0.6168124863,
"Conversation":0.1734567056,
"Openness to Change":0.430397799,
"Hedonism":0.158430861,
"Self-enhancement":0.3399782773,
"Self-transcendence":0.2556183242,
"n":76.0
},
"75%":{
"Openness":0.7561884082,
"Conscientousness":0.6510142733,
"Extraversion":0.7274713099,
"Agreeableness":0.4492181284,
"Emotional_Range":0.7010886899,
"Conversation":0.2547882803,
"Openness to Change":0.4846609371,
"Hedonism":0.2265744616,
"Self-enhancement":0.4299178279,
"Self-transcendence":0.3220190548,
"n":80.0
},
"max":{
"Openness":0.95992792,
"Conscientousness":0.960118167,
"Extraversion":0.9794365923,
"Agreeableness":0.8993661095,
"Emotional_Range":0.9415769334,
"Conversation":0.7793932512,
"Openness to Change":0.7557249986,
"Hedonism":0.680102991,
"Self-enhancement":0.7826336181,
"Self-transcendence":0.6273682888,
"n":313.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 profession with the lowest level of Hedonism?
# 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 profession with the lowest level of Hedonism?
df.columns = ['Profession', 'Openness', 'Conscientousness', 'Extraversion', 'Agreeableness', 'Emotional_Range', 'Conversation', 'Openness to Change', 'Hedonism', 'Self-enhancement', 'Self-transcendence', 'n']
# Expected output type: is category, this will be checked.
return | 20250129013715 |
50 | Which profession has the highest Emotional_Range? | 052_Professional | dev | category | ['Profession', 'Emotional_Range'] | 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": "Profession",
"type": "category"
},
{
"name": "Openness",
"type": "float64"
},
{
"name": "Conscientousness",
"type": "float64"
},
{
"name": "Extraversion",
"type": "float64"
},
{
"name": "Agreeableness",
"type": "float64"
},
{
"name": "Emotional_Range",
"type": "float64"
},
{
"name": "Conversation",
"type": "float64"
},
{
"name": "Openness to Change",
"type": "float64"
},
{
"name": "Hedonism",
"type": "float64"
},
{
"name": "Self-enhancement",
"type": "float64"
},
{
"name": "Self-transcendence",
"type": "float64"
},
{
"name": "n",
"type": "uint16"
}
]
}
# Description of dataframe columns.
df_descrption = {
"count":{
"Openness":1227.0,
"Conscientousness":1227.0,
"Extraversion":1227.0,
"Agreeableness":1227.0,
"Emotional_Range":1227.0,
"Conversation":1227.0,
"Openness to Change":1227.0,
"Hedonism":1227.0,
"Self-enhancement":1227.0,
"Self-transcendence":1227.0,
"n":1227.0
},
"mean":{
"Openness":0.6818599599,
"Conscientousness":0.5494864934,
"Extraversion":0.5999407609,
"Agreeableness":0.3300650815,
"Emotional_Range":0.6150157566,
"Conversation":0.1954283756,
"Openness to Change":0.4297269623,
"Hedonism":0.1854087597,
"Self-enhancement":0.3530469421,
"Self-transcendence":0.2674535075,
"n":82.4392828036
},
"std":{
"Openness":0.1062055359,
"Conscientousness":0.1504663216,
"Extraversion":0.1730540692,
"Agreeableness":0.1775762646,
"Emotional_Range":0.1320494061,
"Conversation":0.1168313736,
"Openness to Change":0.0884607635,
"Hedonism":0.101973799,
"Self-enhancement":0.1235634015,
"Self-transcendence":0.098292791,
"n":25.8098237833
},
"min":{
"Openness":0.2152542646,
"Conscientousness":0.1085605602,
"Extraversion":0.1022540075,
"Agreeableness":0.017733368,
"Emotional_Range":0.165238157,
"Conversation":0.0124883557,
"Openness to Change":0.1470387283,
"Hedonism":0.0290857203,
"Self-enhancement":0.0298680791,
"Self-transcendence":0.0353641396,
"n":50.0
},
"25%":{
"Openness":0.6159645036,
"Conscientousness":0.453015216,
"Extraversion":0.5015413749,
"Agreeableness":0.1927662685,
"Emotional_Range":0.5281815531,
"Conversation":0.1087056755,
"Openness to Change":0.3720593776,
"Hedonism":0.1141935636,
"Self-enhancement":0.2732188024,
"Self-transcendence":0.2014597353,
"n":72.0
},
"50%":{
"Openness":0.6877670374,
"Conscientousness":0.5529477526,
"Extraversion":0.6337253665,
"Agreeableness":0.3236347592,
"Emotional_Range":0.6168124863,
"Conversation":0.1734567056,
"Openness to Change":0.430397799,
"Hedonism":0.158430861,
"Self-enhancement":0.3399782773,
"Self-transcendence":0.2556183242,
"n":76.0
},
"75%":{
"Openness":0.7561884082,
"Conscientousness":0.6510142733,
"Extraversion":0.7274713099,
"Agreeableness":0.4492181284,
"Emotional_Range":0.7010886899,
"Conversation":0.2547882803,
"Openness to Change":0.4846609371,
"Hedonism":0.2265744616,
"Self-enhancement":0.4299178279,
"Self-transcendence":0.3220190548,
"n":80.0
},
"max":{
"Openness":0.95992792,
"Conscientousness":0.960118167,
"Extraversion":0.9794365923,
"Agreeableness":0.8993661095,
"Emotional_Range":0.9415769334,
"Conversation":0.7793932512,
"Openness to Change":0.7557249986,
"Hedonism":0.680102991,
"Self-enhancement":0.7826336181,
"Self-transcendence":0.6273682888,
"n":313.0
}
}
# Randome sample of 10 rows from the dataframe.
df_random_sample = {
"count":{
"Openness":1227.0,
"Conscientousness":1227.0,
"Extraversion":1227.0,
"Agreeableness":1227.0,
"Emotional_Range":1227.0,
"Conversation":1227.0,
"Openness to Change":1227.0,
"Hedonism":1227.0,
"Self-enhancement":1227.0,
"Self-transcendence":1227.0,
"n":1227.0
},
"mean":{
"Openness":0.6818599599,
"Conscientousness":0.5494864934,
"Extraversion":0.5999407609,
"Agreeableness":0.3300650815,
"Emotional_Range":0.6150157566,
"Conversation":0.1954283756,
"Openness to Change":0.4297269623,
"Hedonism":0.1854087597,
"Self-enhancement":0.3530469421,
"Self-transcendence":0.2674535075,
"n":82.4392828036
},
"std":{
"Openness":0.1062055359,
"Conscientousness":0.1504663216,
"Extraversion":0.1730540692,
"Agreeableness":0.1775762646,
"Emotional_Range":0.1320494061,
"Conversation":0.1168313736,
"Openness to Change":0.0884607635,
"Hedonism":0.101973799,
"Self-enhancement":0.1235634015,
"Self-transcendence":0.098292791,
"n":25.8098237833
},
"min":{
"Openness":0.2152542646,
"Conscientousness":0.1085605602,
"Extraversion":0.1022540075,
"Agreeableness":0.017733368,
"Emotional_Range":0.165238157,
"Conversation":0.0124883557,
"Openness to Change":0.1470387283,
"Hedonism":0.0290857203,
"Self-enhancement":0.0298680791,
"Self-transcendence":0.0353641396,
"n":50.0
},
"25%":{
"Openness":0.6159645036,
"Conscientousness":0.453015216,
"Extraversion":0.5015413749,
"Agreeableness":0.1927662685,
"Emotional_Range":0.5281815531,
"Conversation":0.1087056755,
"Openness to Change":0.3720593776,
"Hedonism":0.1141935636,
"Self-enhancement":0.2732188024,
"Self-transcendence":0.2014597353,
"n":72.0
},
"50%":{
"Openness":0.6877670374,
"Conscientousness":0.5529477526,
"Extraversion":0.6337253665,
"Agreeableness":0.3236347592,
"Emotional_Range":0.6168124863,
"Conversation":0.1734567056,
"Openness to Change":0.430397799,
"Hedonism":0.158430861,
"Self-enhancement":0.3399782773,
"Self-transcendence":0.2556183242,
"n":76.0
},
"75%":{
"Openness":0.7561884082,
"Conscientousness":0.6510142733,
"Extraversion":0.7274713099,
"Agreeableness":0.4492181284,
"Emotional_Range":0.7010886899,
"Conversation":0.2547882803,
"Openness to Change":0.4846609371,
"Hedonism":0.2265744616,
"Self-enhancement":0.4299178279,
"Self-transcendence":0.3220190548,
"n":80.0
},
"max":{
"Openness":0.95992792,
"Conscientousness":0.960118167,
"Extraversion":0.9794365923,
"Agreeableness":0.8993661095,
"Emotional_Range":0.9415769334,
"Conversation":0.7793932512,
"Openness to Change":0.7557249986,
"Hedonism":0.680102991,
"Self-enhancement":0.7826336181,
"Self-transcendence":0.6273682888,
"n":313.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 profession has the highest Emotional_Range?
# 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 profession has the highest Emotional_Range?
df.columns = ['Profession', 'Openness', 'Conscientousness', 'Extraversion', 'Agreeableness', 'Emotional_Range', 'Conversation', 'Openness to Change', 'Hedonism', 'Self-enhancement', 'Self-transcendence', 'n']
# Expected output type: is category, this will be checked.
return | 20250129013715 |
51 | What is the profession with the highest number of records (n)? | 052_Professional | dev | category | ['Profession', 'n'] | 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": "Profession",
"type": "category"
},
{
"name": "Openness",
"type": "float64"
},
{
"name": "Conscientousness",
"type": "float64"
},
{
"name": "Extraversion",
"type": "float64"
},
{
"name": "Agreeableness",
"type": "float64"
},
{
"name": "Emotional_Range",
"type": "float64"
},
{
"name": "Conversation",
"type": "float64"
},
{
"name": "Openness to Change",
"type": "float64"
},
{
"name": "Hedonism",
"type": "float64"
},
{
"name": "Self-enhancement",
"type": "float64"
},
{
"name": "Self-transcendence",
"type": "float64"
},
{
"name": "n",
"type": "uint16"
}
]
}
# Description of dataframe columns.
df_descrption = {
"count":{
"Openness":1227.0,
"Conscientousness":1227.0,
"Extraversion":1227.0,
"Agreeableness":1227.0,
"Emotional_Range":1227.0,
"Conversation":1227.0,
"Openness to Change":1227.0,
"Hedonism":1227.0,
"Self-enhancement":1227.0,
"Self-transcendence":1227.0,
"n":1227.0
},
"mean":{
"Openness":0.6818599599,
"Conscientousness":0.5494864934,
"Extraversion":0.5999407609,
"Agreeableness":0.3300650815,
"Emotional_Range":0.6150157566,
"Conversation":0.1954283756,
"Openness to Change":0.4297269623,
"Hedonism":0.1854087597,
"Self-enhancement":0.3530469421,
"Self-transcendence":0.2674535075,
"n":82.4392828036
},
"std":{
"Openness":0.1062055359,
"Conscientousness":0.1504663216,
"Extraversion":0.1730540692,
"Agreeableness":0.1775762646,
"Emotional_Range":0.1320494061,
"Conversation":0.1168313736,
"Openness to Change":0.0884607635,
"Hedonism":0.101973799,
"Self-enhancement":0.1235634015,
"Self-transcendence":0.098292791,
"n":25.8098237833
},
"min":{
"Openness":0.2152542646,
"Conscientousness":0.1085605602,
"Extraversion":0.1022540075,
"Agreeableness":0.017733368,
"Emotional_Range":0.165238157,
"Conversation":0.0124883557,
"Openness to Change":0.1470387283,
"Hedonism":0.0290857203,
"Self-enhancement":0.0298680791,
"Self-transcendence":0.0353641396,
"n":50.0
},
"25%":{
"Openness":0.6159645036,
"Conscientousness":0.453015216,
"Extraversion":0.5015413749,
"Agreeableness":0.1927662685,
"Emotional_Range":0.5281815531,
"Conversation":0.1087056755,
"Openness to Change":0.3720593776,
"Hedonism":0.1141935636,
"Self-enhancement":0.2732188024,
"Self-transcendence":0.2014597353,
"n":72.0
},
"50%":{
"Openness":0.6877670374,
"Conscientousness":0.5529477526,
"Extraversion":0.6337253665,
"Agreeableness":0.3236347592,
"Emotional_Range":0.6168124863,
"Conversation":0.1734567056,
"Openness to Change":0.430397799,
"Hedonism":0.158430861,
"Self-enhancement":0.3399782773,
"Self-transcendence":0.2556183242,
"n":76.0
},
"75%":{
"Openness":0.7561884082,
"Conscientousness":0.6510142733,
"Extraversion":0.7274713099,
"Agreeableness":0.4492181284,
"Emotional_Range":0.7010886899,
"Conversation":0.2547882803,
"Openness to Change":0.4846609371,
"Hedonism":0.2265744616,
"Self-enhancement":0.4299178279,
"Self-transcendence":0.3220190548,
"n":80.0
},
"max":{
"Openness":0.95992792,
"Conscientousness":0.960118167,
"Extraversion":0.9794365923,
"Agreeableness":0.8993661095,
"Emotional_Range":0.9415769334,
"Conversation":0.7793932512,
"Openness to Change":0.7557249986,
"Hedonism":0.680102991,
"Self-enhancement":0.7826336181,
"Self-transcendence":0.6273682888,
"n":313.0
}
}
# Randome sample of 10 rows from the dataframe.
df_random_sample = {
"count":{
"Openness":1227.0,
"Conscientousness":1227.0,
"Extraversion":1227.0,
"Agreeableness":1227.0,
"Emotional_Range":1227.0,
"Conversation":1227.0,
"Openness to Change":1227.0,
"Hedonism":1227.0,
"Self-enhancement":1227.0,
"Self-transcendence":1227.0,
"n":1227.0
},
"mean":{
"Openness":0.6818599599,
"Conscientousness":0.5494864934,
"Extraversion":0.5999407609,
"Agreeableness":0.3300650815,
"Emotional_Range":0.6150157566,
"Conversation":0.1954283756,
"Openness to Change":0.4297269623,
"Hedonism":0.1854087597,
"Self-enhancement":0.3530469421,
"Self-transcendence":0.2674535075,
"n":82.4392828036
},
"std":{
"Openness":0.1062055359,
"Conscientousness":0.1504663216,
"Extraversion":0.1730540692,
"Agreeableness":0.1775762646,
"Emotional_Range":0.1320494061,
"Conversation":0.1168313736,
"Openness to Change":0.0884607635,
"Hedonism":0.101973799,
"Self-enhancement":0.1235634015,
"Self-transcendence":0.098292791,
"n":25.8098237833
},
"min":{
"Openness":0.2152542646,
"Conscientousness":0.1085605602,
"Extraversion":0.1022540075,
"Agreeableness":0.017733368,
"Emotional_Range":0.165238157,
"Conversation":0.0124883557,
"Openness to Change":0.1470387283,
"Hedonism":0.0290857203,
"Self-enhancement":0.0298680791,
"Self-transcendence":0.0353641396,
"n":50.0
},
"25%":{
"Openness":0.6159645036,
"Conscientousness":0.453015216,
"Extraversion":0.5015413749,
"Agreeableness":0.1927662685,
"Emotional_Range":0.5281815531,
"Conversation":0.1087056755,
"Openness to Change":0.3720593776,
"Hedonism":0.1141935636,
"Self-enhancement":0.2732188024,
"Self-transcendence":0.2014597353,
"n":72.0
},
"50%":{
"Openness":0.6877670374,
"Conscientousness":0.5529477526,
"Extraversion":0.6337253665,
"Agreeableness":0.3236347592,
"Emotional_Range":0.6168124863,
"Conversation":0.1734567056,
"Openness to Change":0.430397799,
"Hedonism":0.158430861,
"Self-enhancement":0.3399782773,
"Self-transcendence":0.2556183242,
"n":76.0
},
"75%":{
"Openness":0.7561884082,
"Conscientousness":0.6510142733,
"Extraversion":0.7274713099,
"Agreeableness":0.4492181284,
"Emotional_Range":0.7010886899,
"Conversation":0.2547882803,
"Openness to Change":0.4846609371,
"Hedonism":0.2265744616,
"Self-enhancement":0.4299178279,
"Self-transcendence":0.3220190548,
"n":80.0
},
"max":{
"Openness":0.95992792,
"Conscientousness":0.960118167,
"Extraversion":0.9794365923,
"Agreeableness":0.8993661095,
"Emotional_Range":0.9415769334,
"Conversation":0.7793932512,
"Openness to Change":0.7557249986,
"Hedonism":0.680102991,
"Self-enhancement":0.7826336181,
"Self-transcendence":0.6273682888,
"n":313.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 profession with the highest number of records (n)?
# 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 profession with the highest number of records (n)?
df.columns = ['Profession', 'Openness', 'Conscientousness', 'Extraversion', 'Agreeableness', 'Emotional_Range', 'Conversation', 'Openness to Change', 'Hedonism', 'Self-enhancement', 'Self-transcendence', 'n']
# Expected output type: is category, this will be checked.
return | 20250129013715 |
52 | What are the top 3 professions with the highest Openness? | 052_Professional | dev | list[category] | ['Profession', 'Openness'] | 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": "Profession",
"type": "category"
},
{
"name": "Openness",
"type": "float64"
},
{
"name": "Conscientousness",
"type": "float64"
},
{
"name": "Extraversion",
"type": "float64"
},
{
"name": "Agreeableness",
"type": "float64"
},
{
"name": "Emotional_Range",
"type": "float64"
},
{
"name": "Conversation",
"type": "float64"
},
{
"name": "Openness to Change",
"type": "float64"
},
{
"name": "Hedonism",
"type": "float64"
},
{
"name": "Self-enhancement",
"type": "float64"
},
{
"name": "Self-transcendence",
"type": "float64"
},
{
"name": "n",
"type": "uint16"
}
]
}
# Description of dataframe columns.
df_descrption = {
"count":{
"Openness":1227.0,
"Conscientousness":1227.0,
"Extraversion":1227.0,
"Agreeableness":1227.0,
"Emotional_Range":1227.0,
"Conversation":1227.0,
"Openness to Change":1227.0,
"Hedonism":1227.0,
"Self-enhancement":1227.0,
"Self-transcendence":1227.0,
"n":1227.0
},
"mean":{
"Openness":0.6818599599,
"Conscientousness":0.5494864934,
"Extraversion":0.5999407609,
"Agreeableness":0.3300650815,
"Emotional_Range":0.6150157566,
"Conversation":0.1954283756,
"Openness to Change":0.4297269623,
"Hedonism":0.1854087597,
"Self-enhancement":0.3530469421,
"Self-transcendence":0.2674535075,
"n":82.4392828036
},
"std":{
"Openness":0.1062055359,
"Conscientousness":0.1504663216,
"Extraversion":0.1730540692,
"Agreeableness":0.1775762646,
"Emotional_Range":0.1320494061,
"Conversation":0.1168313736,
"Openness to Change":0.0884607635,
"Hedonism":0.101973799,
"Self-enhancement":0.1235634015,
"Self-transcendence":0.098292791,
"n":25.8098237833
},
"min":{
"Openness":0.2152542646,
"Conscientousness":0.1085605602,
"Extraversion":0.1022540075,
"Agreeableness":0.017733368,
"Emotional_Range":0.165238157,
"Conversation":0.0124883557,
"Openness to Change":0.1470387283,
"Hedonism":0.0290857203,
"Self-enhancement":0.0298680791,
"Self-transcendence":0.0353641396,
"n":50.0
},
"25%":{
"Openness":0.6159645036,
"Conscientousness":0.453015216,
"Extraversion":0.5015413749,
"Agreeableness":0.1927662685,
"Emotional_Range":0.5281815531,
"Conversation":0.1087056755,
"Openness to Change":0.3720593776,
"Hedonism":0.1141935636,
"Self-enhancement":0.2732188024,
"Self-transcendence":0.2014597353,
"n":72.0
},
"50%":{
"Openness":0.6877670374,
"Conscientousness":0.5529477526,
"Extraversion":0.6337253665,
"Agreeableness":0.3236347592,
"Emotional_Range":0.6168124863,
"Conversation":0.1734567056,
"Openness to Change":0.430397799,
"Hedonism":0.158430861,
"Self-enhancement":0.3399782773,
"Self-transcendence":0.2556183242,
"n":76.0
},
"75%":{
"Openness":0.7561884082,
"Conscientousness":0.6510142733,
"Extraversion":0.7274713099,
"Agreeableness":0.4492181284,
"Emotional_Range":0.7010886899,
"Conversation":0.2547882803,
"Openness to Change":0.4846609371,
"Hedonism":0.2265744616,
"Self-enhancement":0.4299178279,
"Self-transcendence":0.3220190548,
"n":80.0
},
"max":{
"Openness":0.95992792,
"Conscientousness":0.960118167,
"Extraversion":0.9794365923,
"Agreeableness":0.8993661095,
"Emotional_Range":0.9415769334,
"Conversation":0.7793932512,
"Openness to Change":0.7557249986,
"Hedonism":0.680102991,
"Self-enhancement":0.7826336181,
"Self-transcendence":0.6273682888,
"n":313.0
}
}
# Randome sample of 10 rows from the dataframe.
df_random_sample = {
"count":{
"Openness":1227.0,
"Conscientousness":1227.0,
"Extraversion":1227.0,
"Agreeableness":1227.0,
"Emotional_Range":1227.0,
"Conversation":1227.0,
"Openness to Change":1227.0,
"Hedonism":1227.0,
"Self-enhancement":1227.0,
"Self-transcendence":1227.0,
"n":1227.0
},
"mean":{
"Openness":0.6818599599,
"Conscientousness":0.5494864934,
"Extraversion":0.5999407609,
"Agreeableness":0.3300650815,
"Emotional_Range":0.6150157566,
"Conversation":0.1954283756,
"Openness to Change":0.4297269623,
"Hedonism":0.1854087597,
"Self-enhancement":0.3530469421,
"Self-transcendence":0.2674535075,
"n":82.4392828036
},
"std":{
"Openness":0.1062055359,
"Conscientousness":0.1504663216,
"Extraversion":0.1730540692,
"Agreeableness":0.1775762646,
"Emotional_Range":0.1320494061,
"Conversation":0.1168313736,
"Openness to Change":0.0884607635,
"Hedonism":0.101973799,
"Self-enhancement":0.1235634015,
"Self-transcendence":0.098292791,
"n":25.8098237833
},
"min":{
"Openness":0.2152542646,
"Conscientousness":0.1085605602,
"Extraversion":0.1022540075,
"Agreeableness":0.017733368,
"Emotional_Range":0.165238157,
"Conversation":0.0124883557,
"Openness to Change":0.1470387283,
"Hedonism":0.0290857203,
"Self-enhancement":0.0298680791,
"Self-transcendence":0.0353641396,
"n":50.0
},
"25%":{
"Openness":0.6159645036,
"Conscientousness":0.453015216,
"Extraversion":0.5015413749,
"Agreeableness":0.1927662685,
"Emotional_Range":0.5281815531,
"Conversation":0.1087056755,
"Openness to Change":0.3720593776,
"Hedonism":0.1141935636,
"Self-enhancement":0.2732188024,
"Self-transcendence":0.2014597353,
"n":72.0
},
"50%":{
"Openness":0.6877670374,
"Conscientousness":0.5529477526,
"Extraversion":0.6337253665,
"Agreeableness":0.3236347592,
"Emotional_Range":0.6168124863,
"Conversation":0.1734567056,
"Openness to Change":0.430397799,
"Hedonism":0.158430861,
"Self-enhancement":0.3399782773,
"Self-transcendence":0.2556183242,
"n":76.0
},
"75%":{
"Openness":0.7561884082,
"Conscientousness":0.6510142733,
"Extraversion":0.7274713099,
"Agreeableness":0.4492181284,
"Emotional_Range":0.7010886899,
"Conversation":0.2547882803,
"Openness to Change":0.4846609371,
"Hedonism":0.2265744616,
"Self-enhancement":0.4299178279,
"Self-transcendence":0.3220190548,
"n":80.0
},
"max":{
"Openness":0.95992792,
"Conscientousness":0.960118167,
"Extraversion":0.9794365923,
"Agreeableness":0.8993661095,
"Emotional_Range":0.9415769334,
"Conversation":0.7793932512,
"Openness to Change":0.7557249986,
"Hedonism":0.680102991,
"Self-enhancement":0.7826336181,
"Self-transcendence":0.6273682888,
"n":313.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 professions with the highest Openness?
# 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 professions with the highest Openness?
df.columns = ['Profession', 'Openness', 'Conscientousness', 'Extraversion', 'Agreeableness', 'Emotional_Range', 'Conversation', 'Openness to Change', 'Hedonism', 'Self-enhancement', 'Self-transcendence', 'n']
# Expected output type: is list[category], this will be checked.
return | 20250129013716 |
53 | Which are the bottom 4 professions in terms of Agreeableness? | 052_Professional | dev | list[category] | ['Profession', 'Agreeableness'] | 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": "Profession",
"type": "category"
},
{
"name": "Openness",
"type": "float64"
},
{
"name": "Conscientousness",
"type": "float64"
},
{
"name": "Extraversion",
"type": "float64"
},
{
"name": "Agreeableness",
"type": "float64"
},
{
"name": "Emotional_Range",
"type": "float64"
},
{
"name": "Conversation",
"type": "float64"
},
{
"name": "Openness to Change",
"type": "float64"
},
{
"name": "Hedonism",
"type": "float64"
},
{
"name": "Self-enhancement",
"type": "float64"
},
{
"name": "Self-transcendence",
"type": "float64"
},
{
"name": "n",
"type": "uint16"
}
]
}
# Description of dataframe columns.
df_descrption = {
"count":{
"Openness":1227.0,
"Conscientousness":1227.0,
"Extraversion":1227.0,
"Agreeableness":1227.0,
"Emotional_Range":1227.0,
"Conversation":1227.0,
"Openness to Change":1227.0,
"Hedonism":1227.0,
"Self-enhancement":1227.0,
"Self-transcendence":1227.0,
"n":1227.0
},
"mean":{
"Openness":0.6818599599,
"Conscientousness":0.5494864934,
"Extraversion":0.5999407609,
"Agreeableness":0.3300650815,
"Emotional_Range":0.6150157566,
"Conversation":0.1954283756,
"Openness to Change":0.4297269623,
"Hedonism":0.1854087597,
"Self-enhancement":0.3530469421,
"Self-transcendence":0.2674535075,
"n":82.4392828036
},
"std":{
"Openness":0.1062055359,
"Conscientousness":0.1504663216,
"Extraversion":0.1730540692,
"Agreeableness":0.1775762646,
"Emotional_Range":0.1320494061,
"Conversation":0.1168313736,
"Openness to Change":0.0884607635,
"Hedonism":0.101973799,
"Self-enhancement":0.1235634015,
"Self-transcendence":0.098292791,
"n":25.8098237833
},
"min":{
"Openness":0.2152542646,
"Conscientousness":0.1085605602,
"Extraversion":0.1022540075,
"Agreeableness":0.017733368,
"Emotional_Range":0.165238157,
"Conversation":0.0124883557,
"Openness to Change":0.1470387283,
"Hedonism":0.0290857203,
"Self-enhancement":0.0298680791,
"Self-transcendence":0.0353641396,
"n":50.0
},
"25%":{
"Openness":0.6159645036,
"Conscientousness":0.453015216,
"Extraversion":0.5015413749,
"Agreeableness":0.1927662685,
"Emotional_Range":0.5281815531,
"Conversation":0.1087056755,
"Openness to Change":0.3720593776,
"Hedonism":0.1141935636,
"Self-enhancement":0.2732188024,
"Self-transcendence":0.2014597353,
"n":72.0
},
"50%":{
"Openness":0.6877670374,
"Conscientousness":0.5529477526,
"Extraversion":0.6337253665,
"Agreeableness":0.3236347592,
"Emotional_Range":0.6168124863,
"Conversation":0.1734567056,
"Openness to Change":0.430397799,
"Hedonism":0.158430861,
"Self-enhancement":0.3399782773,
"Self-transcendence":0.2556183242,
"n":76.0
},
"75%":{
"Openness":0.7561884082,
"Conscientousness":0.6510142733,
"Extraversion":0.7274713099,
"Agreeableness":0.4492181284,
"Emotional_Range":0.7010886899,
"Conversation":0.2547882803,
"Openness to Change":0.4846609371,
"Hedonism":0.2265744616,
"Self-enhancement":0.4299178279,
"Self-transcendence":0.3220190548,
"n":80.0
},
"max":{
"Openness":0.95992792,
"Conscientousness":0.960118167,
"Extraversion":0.9794365923,
"Agreeableness":0.8993661095,
"Emotional_Range":0.9415769334,
"Conversation":0.7793932512,
"Openness to Change":0.7557249986,
"Hedonism":0.680102991,
"Self-enhancement":0.7826336181,
"Self-transcendence":0.6273682888,
"n":313.0
}
}
# Randome sample of 10 rows from the dataframe.
df_random_sample = {
"count":{
"Openness":1227.0,
"Conscientousness":1227.0,
"Extraversion":1227.0,
"Agreeableness":1227.0,
"Emotional_Range":1227.0,
"Conversation":1227.0,
"Openness to Change":1227.0,
"Hedonism":1227.0,
"Self-enhancement":1227.0,
"Self-transcendence":1227.0,
"n":1227.0
},
"mean":{
"Openness":0.6818599599,
"Conscientousness":0.5494864934,
"Extraversion":0.5999407609,
"Agreeableness":0.3300650815,
"Emotional_Range":0.6150157566,
"Conversation":0.1954283756,
"Openness to Change":0.4297269623,
"Hedonism":0.1854087597,
"Self-enhancement":0.3530469421,
"Self-transcendence":0.2674535075,
"n":82.4392828036
},
"std":{
"Openness":0.1062055359,
"Conscientousness":0.1504663216,
"Extraversion":0.1730540692,
"Agreeableness":0.1775762646,
"Emotional_Range":0.1320494061,
"Conversation":0.1168313736,
"Openness to Change":0.0884607635,
"Hedonism":0.101973799,
"Self-enhancement":0.1235634015,
"Self-transcendence":0.098292791,
"n":25.8098237833
},
"min":{
"Openness":0.2152542646,
"Conscientousness":0.1085605602,
"Extraversion":0.1022540075,
"Agreeableness":0.017733368,
"Emotional_Range":0.165238157,
"Conversation":0.0124883557,
"Openness to Change":0.1470387283,
"Hedonism":0.0290857203,
"Self-enhancement":0.0298680791,
"Self-transcendence":0.0353641396,
"n":50.0
},
"25%":{
"Openness":0.6159645036,
"Conscientousness":0.453015216,
"Extraversion":0.5015413749,
"Agreeableness":0.1927662685,
"Emotional_Range":0.5281815531,
"Conversation":0.1087056755,
"Openness to Change":0.3720593776,
"Hedonism":0.1141935636,
"Self-enhancement":0.2732188024,
"Self-transcendence":0.2014597353,
"n":72.0
},
"50%":{
"Openness":0.6877670374,
"Conscientousness":0.5529477526,
"Extraversion":0.6337253665,
"Agreeableness":0.3236347592,
"Emotional_Range":0.6168124863,
"Conversation":0.1734567056,
"Openness to Change":0.430397799,
"Hedonism":0.158430861,
"Self-enhancement":0.3399782773,
"Self-transcendence":0.2556183242,
"n":76.0
},
"75%":{
"Openness":0.7561884082,
"Conscientousness":0.6510142733,
"Extraversion":0.7274713099,
"Agreeableness":0.4492181284,
"Emotional_Range":0.7010886899,
"Conversation":0.2547882803,
"Openness to Change":0.4846609371,
"Hedonism":0.2265744616,
"Self-enhancement":0.4299178279,
"Self-transcendence":0.3220190548,
"n":80.0
},
"max":{
"Openness":0.95992792,
"Conscientousness":0.960118167,
"Extraversion":0.9794365923,
"Agreeableness":0.8993661095,
"Emotional_Range":0.9415769334,
"Conversation":0.7793932512,
"Openness to Change":0.7557249986,
"Hedonism":0.680102991,
"Self-enhancement":0.7826336181,
"Self-transcendence":0.6273682888,
"n":313.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 bottom 4 professions in terms of Agreeableness?
# 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 bottom 4 professions in terms of Agreeableness?
df.columns = ['Profession', 'Openness', 'Conscientousness', 'Extraversion', 'Agreeableness', 'Emotional_Range', 'Conversation', 'Openness to Change', 'Hedonism', 'Self-enhancement', 'Self-transcendence', 'n']
# Expected output type: is list[category], this will be checked.
return | 20250129013716 |
54 | List the top 5 professions with the highest Conversation levels. | 052_Professional | dev | list[category] | ['Profession', 'Conversation'] | 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": "Profession",
"type": "category"
},
{
"name": "Openness",
"type": "float64"
},
{
"name": "Conscientousness",
"type": "float64"
},
{
"name": "Extraversion",
"type": "float64"
},
{
"name": "Agreeableness",
"type": "float64"
},
{
"name": "Emotional_Range",
"type": "float64"
},
{
"name": "Conversation",
"type": "float64"
},
{
"name": "Openness to Change",
"type": "float64"
},
{
"name": "Hedonism",
"type": "float64"
},
{
"name": "Self-enhancement",
"type": "float64"
},
{
"name": "Self-transcendence",
"type": "float64"
},
{
"name": "n",
"type": "uint16"
}
]
}
# Description of dataframe columns.
df_descrption = {
"count":{
"Openness":1227.0,
"Conscientousness":1227.0,
"Extraversion":1227.0,
"Agreeableness":1227.0,
"Emotional_Range":1227.0,
"Conversation":1227.0,
"Openness to Change":1227.0,
"Hedonism":1227.0,
"Self-enhancement":1227.0,
"Self-transcendence":1227.0,
"n":1227.0
},
"mean":{
"Openness":0.6818599599,
"Conscientousness":0.5494864934,
"Extraversion":0.5999407609,
"Agreeableness":0.3300650815,
"Emotional_Range":0.6150157566,
"Conversation":0.1954283756,
"Openness to Change":0.4297269623,
"Hedonism":0.1854087597,
"Self-enhancement":0.3530469421,
"Self-transcendence":0.2674535075,
"n":82.4392828036
},
"std":{
"Openness":0.1062055359,
"Conscientousness":0.1504663216,
"Extraversion":0.1730540692,
"Agreeableness":0.1775762646,
"Emotional_Range":0.1320494061,
"Conversation":0.1168313736,
"Openness to Change":0.0884607635,
"Hedonism":0.101973799,
"Self-enhancement":0.1235634015,
"Self-transcendence":0.098292791,
"n":25.8098237833
},
"min":{
"Openness":0.2152542646,
"Conscientousness":0.1085605602,
"Extraversion":0.1022540075,
"Agreeableness":0.017733368,
"Emotional_Range":0.165238157,
"Conversation":0.0124883557,
"Openness to Change":0.1470387283,
"Hedonism":0.0290857203,
"Self-enhancement":0.0298680791,
"Self-transcendence":0.0353641396,
"n":50.0
},
"25%":{
"Openness":0.6159645036,
"Conscientousness":0.453015216,
"Extraversion":0.5015413749,
"Agreeableness":0.1927662685,
"Emotional_Range":0.5281815531,
"Conversation":0.1087056755,
"Openness to Change":0.3720593776,
"Hedonism":0.1141935636,
"Self-enhancement":0.2732188024,
"Self-transcendence":0.2014597353,
"n":72.0
},
"50%":{
"Openness":0.6877670374,
"Conscientousness":0.5529477526,
"Extraversion":0.6337253665,
"Agreeableness":0.3236347592,
"Emotional_Range":0.6168124863,
"Conversation":0.1734567056,
"Openness to Change":0.430397799,
"Hedonism":0.158430861,
"Self-enhancement":0.3399782773,
"Self-transcendence":0.2556183242,
"n":76.0
},
"75%":{
"Openness":0.7561884082,
"Conscientousness":0.6510142733,
"Extraversion":0.7274713099,
"Agreeableness":0.4492181284,
"Emotional_Range":0.7010886899,
"Conversation":0.2547882803,
"Openness to Change":0.4846609371,
"Hedonism":0.2265744616,
"Self-enhancement":0.4299178279,
"Self-transcendence":0.3220190548,
"n":80.0
},
"max":{
"Openness":0.95992792,
"Conscientousness":0.960118167,
"Extraversion":0.9794365923,
"Agreeableness":0.8993661095,
"Emotional_Range":0.9415769334,
"Conversation":0.7793932512,
"Openness to Change":0.7557249986,
"Hedonism":0.680102991,
"Self-enhancement":0.7826336181,
"Self-transcendence":0.6273682888,
"n":313.0
}
}
# Randome sample of 10 rows from the dataframe.
df_random_sample = {
"count":{
"Openness":1227.0,
"Conscientousness":1227.0,
"Extraversion":1227.0,
"Agreeableness":1227.0,
"Emotional_Range":1227.0,
"Conversation":1227.0,
"Openness to Change":1227.0,
"Hedonism":1227.0,
"Self-enhancement":1227.0,
"Self-transcendence":1227.0,
"n":1227.0
},
"mean":{
"Openness":0.6818599599,
"Conscientousness":0.5494864934,
"Extraversion":0.5999407609,
"Agreeableness":0.3300650815,
"Emotional_Range":0.6150157566,
"Conversation":0.1954283756,
"Openness to Change":0.4297269623,
"Hedonism":0.1854087597,
"Self-enhancement":0.3530469421,
"Self-transcendence":0.2674535075,
"n":82.4392828036
},
"std":{
"Openness":0.1062055359,
"Conscientousness":0.1504663216,
"Extraversion":0.1730540692,
"Agreeableness":0.1775762646,
"Emotional_Range":0.1320494061,
"Conversation":0.1168313736,
"Openness to Change":0.0884607635,
"Hedonism":0.101973799,
"Self-enhancement":0.1235634015,
"Self-transcendence":0.098292791,
"n":25.8098237833
},
"min":{
"Openness":0.2152542646,
"Conscientousness":0.1085605602,
"Extraversion":0.1022540075,
"Agreeableness":0.017733368,
"Emotional_Range":0.165238157,
"Conversation":0.0124883557,
"Openness to Change":0.1470387283,
"Hedonism":0.0290857203,
"Self-enhancement":0.0298680791,
"Self-transcendence":0.0353641396,
"n":50.0
},
"25%":{
"Openness":0.6159645036,
"Conscientousness":0.453015216,
"Extraversion":0.5015413749,
"Agreeableness":0.1927662685,
"Emotional_Range":0.5281815531,
"Conversation":0.1087056755,
"Openness to Change":0.3720593776,
"Hedonism":0.1141935636,
"Self-enhancement":0.2732188024,
"Self-transcendence":0.2014597353,
"n":72.0
},
"50%":{
"Openness":0.6877670374,
"Conscientousness":0.5529477526,
"Extraversion":0.6337253665,
"Agreeableness":0.3236347592,
"Emotional_Range":0.6168124863,
"Conversation":0.1734567056,
"Openness to Change":0.430397799,
"Hedonism":0.158430861,
"Self-enhancement":0.3399782773,
"Self-transcendence":0.2556183242,
"n":76.0
},
"75%":{
"Openness":0.7561884082,
"Conscientousness":0.6510142733,
"Extraversion":0.7274713099,
"Agreeableness":0.4492181284,
"Emotional_Range":0.7010886899,
"Conversation":0.2547882803,
"Openness to Change":0.4846609371,
"Hedonism":0.2265744616,
"Self-enhancement":0.4299178279,
"Self-transcendence":0.3220190548,
"n":80.0
},
"max":{
"Openness":0.95992792,
"Conscientousness":0.960118167,
"Extraversion":0.9794365923,
"Agreeableness":0.8993661095,
"Emotional_Range":0.9415769334,
"Conversation":0.7793932512,
"Openness to Change":0.7557249986,
"Hedonism":0.680102991,
"Self-enhancement":0.7826336181,
"Self-transcendence":0.6273682888,
"n":313.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 5 professions with the highest Conversation levels.
# 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 5 professions with the highest Conversation levels.
df.columns = ['Profession', 'Openness', 'Conscientousness', 'Extraversion', 'Agreeableness', 'Emotional_Range', 'Conversation', 'Openness to Change', 'Hedonism', 'Self-enhancement', 'Self-transcendence', 'n']
# Expected output type: is list[category], this will be checked.
return | 20250129013716 |
55 | Name the bottom 2 professions in terms of Self-enhancement. | 052_Professional | dev | list[category] | ['Profession', 'Self-enhancement'] | 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": "Profession",
"type": "category"
},
{
"name": "Openness",
"type": "float64"
},
{
"name": "Conscientousness",
"type": "float64"
},
{
"name": "Extraversion",
"type": "float64"
},
{
"name": "Agreeableness",
"type": "float64"
},
{
"name": "Emotional_Range",
"type": "float64"
},
{
"name": "Conversation",
"type": "float64"
},
{
"name": "Openness to Change",
"type": "float64"
},
{
"name": "Hedonism",
"type": "float64"
},
{
"name": "Self-enhancement",
"type": "float64"
},
{
"name": "Self-transcendence",
"type": "float64"
},
{
"name": "n",
"type": "uint16"
}
]
}
# Description of dataframe columns.
df_descrption = {
"count":{
"Openness":1227.0,
"Conscientousness":1227.0,
"Extraversion":1227.0,
"Agreeableness":1227.0,
"Emotional_Range":1227.0,
"Conversation":1227.0,
"Openness to Change":1227.0,
"Hedonism":1227.0,
"Self-enhancement":1227.0,
"Self-transcendence":1227.0,
"n":1227.0
},
"mean":{
"Openness":0.6818599599,
"Conscientousness":0.5494864934,
"Extraversion":0.5999407609,
"Agreeableness":0.3300650815,
"Emotional_Range":0.6150157566,
"Conversation":0.1954283756,
"Openness to Change":0.4297269623,
"Hedonism":0.1854087597,
"Self-enhancement":0.3530469421,
"Self-transcendence":0.2674535075,
"n":82.4392828036
},
"std":{
"Openness":0.1062055359,
"Conscientousness":0.1504663216,
"Extraversion":0.1730540692,
"Agreeableness":0.1775762646,
"Emotional_Range":0.1320494061,
"Conversation":0.1168313736,
"Openness to Change":0.0884607635,
"Hedonism":0.101973799,
"Self-enhancement":0.1235634015,
"Self-transcendence":0.098292791,
"n":25.8098237833
},
"min":{
"Openness":0.2152542646,
"Conscientousness":0.1085605602,
"Extraversion":0.1022540075,
"Agreeableness":0.017733368,
"Emotional_Range":0.165238157,
"Conversation":0.0124883557,
"Openness to Change":0.1470387283,
"Hedonism":0.0290857203,
"Self-enhancement":0.0298680791,
"Self-transcendence":0.0353641396,
"n":50.0
},
"25%":{
"Openness":0.6159645036,
"Conscientousness":0.453015216,
"Extraversion":0.5015413749,
"Agreeableness":0.1927662685,
"Emotional_Range":0.5281815531,
"Conversation":0.1087056755,
"Openness to Change":0.3720593776,
"Hedonism":0.1141935636,
"Self-enhancement":0.2732188024,
"Self-transcendence":0.2014597353,
"n":72.0
},
"50%":{
"Openness":0.6877670374,
"Conscientousness":0.5529477526,
"Extraversion":0.6337253665,
"Agreeableness":0.3236347592,
"Emotional_Range":0.6168124863,
"Conversation":0.1734567056,
"Openness to Change":0.430397799,
"Hedonism":0.158430861,
"Self-enhancement":0.3399782773,
"Self-transcendence":0.2556183242,
"n":76.0
},
"75%":{
"Openness":0.7561884082,
"Conscientousness":0.6510142733,
"Extraversion":0.7274713099,
"Agreeableness":0.4492181284,
"Emotional_Range":0.7010886899,
"Conversation":0.2547882803,
"Openness to Change":0.4846609371,
"Hedonism":0.2265744616,
"Self-enhancement":0.4299178279,
"Self-transcendence":0.3220190548,
"n":80.0
},
"max":{
"Openness":0.95992792,
"Conscientousness":0.960118167,
"Extraversion":0.9794365923,
"Agreeableness":0.8993661095,
"Emotional_Range":0.9415769334,
"Conversation":0.7793932512,
"Openness to Change":0.7557249986,
"Hedonism":0.680102991,
"Self-enhancement":0.7826336181,
"Self-transcendence":0.6273682888,
"n":313.0
}
}
# Randome sample of 10 rows from the dataframe.
df_random_sample = {
"count":{
"Openness":1227.0,
"Conscientousness":1227.0,
"Extraversion":1227.0,
"Agreeableness":1227.0,
"Emotional_Range":1227.0,
"Conversation":1227.0,
"Openness to Change":1227.0,
"Hedonism":1227.0,
"Self-enhancement":1227.0,
"Self-transcendence":1227.0,
"n":1227.0
},
"mean":{
"Openness":0.6818599599,
"Conscientousness":0.5494864934,
"Extraversion":0.5999407609,
"Agreeableness":0.3300650815,
"Emotional_Range":0.6150157566,
"Conversation":0.1954283756,
"Openness to Change":0.4297269623,
"Hedonism":0.1854087597,
"Self-enhancement":0.3530469421,
"Self-transcendence":0.2674535075,
"n":82.4392828036
},
"std":{
"Openness":0.1062055359,
"Conscientousness":0.1504663216,
"Extraversion":0.1730540692,
"Agreeableness":0.1775762646,
"Emotional_Range":0.1320494061,
"Conversation":0.1168313736,
"Openness to Change":0.0884607635,
"Hedonism":0.101973799,
"Self-enhancement":0.1235634015,
"Self-transcendence":0.098292791,
"n":25.8098237833
},
"min":{
"Openness":0.2152542646,
"Conscientousness":0.1085605602,
"Extraversion":0.1022540075,
"Agreeableness":0.017733368,
"Emotional_Range":0.165238157,
"Conversation":0.0124883557,
"Openness to Change":0.1470387283,
"Hedonism":0.0290857203,
"Self-enhancement":0.0298680791,
"Self-transcendence":0.0353641396,
"n":50.0
},
"25%":{
"Openness":0.6159645036,
"Conscientousness":0.453015216,
"Extraversion":0.5015413749,
"Agreeableness":0.1927662685,
"Emotional_Range":0.5281815531,
"Conversation":0.1087056755,
"Openness to Change":0.3720593776,
"Hedonism":0.1141935636,
"Self-enhancement":0.2732188024,
"Self-transcendence":0.2014597353,
"n":72.0
},
"50%":{
"Openness":0.6877670374,
"Conscientousness":0.5529477526,
"Extraversion":0.6337253665,
"Agreeableness":0.3236347592,
"Emotional_Range":0.6168124863,
"Conversation":0.1734567056,
"Openness to Change":0.430397799,
"Hedonism":0.158430861,
"Self-enhancement":0.3399782773,
"Self-transcendence":0.2556183242,
"n":76.0
},
"75%":{
"Openness":0.7561884082,
"Conscientousness":0.6510142733,
"Extraversion":0.7274713099,
"Agreeableness":0.4492181284,
"Emotional_Range":0.7010886899,
"Conversation":0.2547882803,
"Openness to Change":0.4846609371,
"Hedonism":0.2265744616,
"Self-enhancement":0.4299178279,
"Self-transcendence":0.3220190548,
"n":80.0
},
"max":{
"Openness":0.95992792,
"Conscientousness":0.960118167,
"Extraversion":0.9794365923,
"Agreeableness":0.8993661095,
"Emotional_Range":0.9415769334,
"Conversation":0.7793932512,
"Openness to Change":0.7557249986,
"Hedonism":0.680102991,
"Self-enhancement":0.7826336181,
"Self-transcendence":0.6273682888,
"n":313.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 bottom 2 professions in terms of Self-enhancement.
# 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 bottom 2 professions in terms of Self-enhancement.
df.columns = ['Profession', 'Openness', 'Conscientousness', 'Extraversion', 'Agreeableness', 'Emotional_Range', 'Conversation', 'Openness to Change', 'Hedonism', 'Self-enhancement', 'Self-transcendence', 'n']
# Expected output type: is list[category], this will be checked.
return | 20250129013716 |
56 | What are the top 3 values of Openness to Change across all professions? | 052_Professional | dev | list[number] | ['Openness to Change'] | 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": "Profession",
"type": "category"
},
{
"name": "Openness",
"type": "float64"
},
{
"name": "Conscientousness",
"type": "float64"
},
{
"name": "Extraversion",
"type": "float64"
},
{
"name": "Agreeableness",
"type": "float64"
},
{
"name": "Emotional_Range",
"type": "float64"
},
{
"name": "Conversation",
"type": "float64"
},
{
"name": "Openness to Change",
"type": "float64"
},
{
"name": "Hedonism",
"type": "float64"
},
{
"name": "Self-enhancement",
"type": "float64"
},
{
"name": "Self-transcendence",
"type": "float64"
},
{
"name": "n",
"type": "uint16"
}
]
}
# Description of dataframe columns.
df_descrption = {
"count":{
"Openness":1227.0,
"Conscientousness":1227.0,
"Extraversion":1227.0,
"Agreeableness":1227.0,
"Emotional_Range":1227.0,
"Conversation":1227.0,
"Openness to Change":1227.0,
"Hedonism":1227.0,
"Self-enhancement":1227.0,
"Self-transcendence":1227.0,
"n":1227.0
},
"mean":{
"Openness":0.6818599599,
"Conscientousness":0.5494864934,
"Extraversion":0.5999407609,
"Agreeableness":0.3300650815,
"Emotional_Range":0.6150157566,
"Conversation":0.1954283756,
"Openness to Change":0.4297269623,
"Hedonism":0.1854087597,
"Self-enhancement":0.3530469421,
"Self-transcendence":0.2674535075,
"n":82.4392828036
},
"std":{
"Openness":0.1062055359,
"Conscientousness":0.1504663216,
"Extraversion":0.1730540692,
"Agreeableness":0.1775762646,
"Emotional_Range":0.1320494061,
"Conversation":0.1168313736,
"Openness to Change":0.0884607635,
"Hedonism":0.101973799,
"Self-enhancement":0.1235634015,
"Self-transcendence":0.098292791,
"n":25.8098237833
},
"min":{
"Openness":0.2152542646,
"Conscientousness":0.1085605602,
"Extraversion":0.1022540075,
"Agreeableness":0.017733368,
"Emotional_Range":0.165238157,
"Conversation":0.0124883557,
"Openness to Change":0.1470387283,
"Hedonism":0.0290857203,
"Self-enhancement":0.0298680791,
"Self-transcendence":0.0353641396,
"n":50.0
},
"25%":{
"Openness":0.6159645036,
"Conscientousness":0.453015216,
"Extraversion":0.5015413749,
"Agreeableness":0.1927662685,
"Emotional_Range":0.5281815531,
"Conversation":0.1087056755,
"Openness to Change":0.3720593776,
"Hedonism":0.1141935636,
"Self-enhancement":0.2732188024,
"Self-transcendence":0.2014597353,
"n":72.0
},
"50%":{
"Openness":0.6877670374,
"Conscientousness":0.5529477526,
"Extraversion":0.6337253665,
"Agreeableness":0.3236347592,
"Emotional_Range":0.6168124863,
"Conversation":0.1734567056,
"Openness to Change":0.430397799,
"Hedonism":0.158430861,
"Self-enhancement":0.3399782773,
"Self-transcendence":0.2556183242,
"n":76.0
},
"75%":{
"Openness":0.7561884082,
"Conscientousness":0.6510142733,
"Extraversion":0.7274713099,
"Agreeableness":0.4492181284,
"Emotional_Range":0.7010886899,
"Conversation":0.2547882803,
"Openness to Change":0.4846609371,
"Hedonism":0.2265744616,
"Self-enhancement":0.4299178279,
"Self-transcendence":0.3220190548,
"n":80.0
},
"max":{
"Openness":0.95992792,
"Conscientousness":0.960118167,
"Extraversion":0.9794365923,
"Agreeableness":0.8993661095,
"Emotional_Range":0.9415769334,
"Conversation":0.7793932512,
"Openness to Change":0.7557249986,
"Hedonism":0.680102991,
"Self-enhancement":0.7826336181,
"Self-transcendence":0.6273682888,
"n":313.0
}
}
# Randome sample of 10 rows from the dataframe.
df_random_sample = {
"count":{
"Openness":1227.0,
"Conscientousness":1227.0,
"Extraversion":1227.0,
"Agreeableness":1227.0,
"Emotional_Range":1227.0,
"Conversation":1227.0,
"Openness to Change":1227.0,
"Hedonism":1227.0,
"Self-enhancement":1227.0,
"Self-transcendence":1227.0,
"n":1227.0
},
"mean":{
"Openness":0.6818599599,
"Conscientousness":0.5494864934,
"Extraversion":0.5999407609,
"Agreeableness":0.3300650815,
"Emotional_Range":0.6150157566,
"Conversation":0.1954283756,
"Openness to Change":0.4297269623,
"Hedonism":0.1854087597,
"Self-enhancement":0.3530469421,
"Self-transcendence":0.2674535075,
"n":82.4392828036
},
"std":{
"Openness":0.1062055359,
"Conscientousness":0.1504663216,
"Extraversion":0.1730540692,
"Agreeableness":0.1775762646,
"Emotional_Range":0.1320494061,
"Conversation":0.1168313736,
"Openness to Change":0.0884607635,
"Hedonism":0.101973799,
"Self-enhancement":0.1235634015,
"Self-transcendence":0.098292791,
"n":25.8098237833
},
"min":{
"Openness":0.2152542646,
"Conscientousness":0.1085605602,
"Extraversion":0.1022540075,
"Agreeableness":0.017733368,
"Emotional_Range":0.165238157,
"Conversation":0.0124883557,
"Openness to Change":0.1470387283,
"Hedonism":0.0290857203,
"Self-enhancement":0.0298680791,
"Self-transcendence":0.0353641396,
"n":50.0
},
"25%":{
"Openness":0.6159645036,
"Conscientousness":0.453015216,
"Extraversion":0.5015413749,
"Agreeableness":0.1927662685,
"Emotional_Range":0.5281815531,
"Conversation":0.1087056755,
"Openness to Change":0.3720593776,
"Hedonism":0.1141935636,
"Self-enhancement":0.2732188024,
"Self-transcendence":0.2014597353,
"n":72.0
},
"50%":{
"Openness":0.6877670374,
"Conscientousness":0.5529477526,
"Extraversion":0.6337253665,
"Agreeableness":0.3236347592,
"Emotional_Range":0.6168124863,
"Conversation":0.1734567056,
"Openness to Change":0.430397799,
"Hedonism":0.158430861,
"Self-enhancement":0.3399782773,
"Self-transcendence":0.2556183242,
"n":76.0
},
"75%":{
"Openness":0.7561884082,
"Conscientousness":0.6510142733,
"Extraversion":0.7274713099,
"Agreeableness":0.4492181284,
"Emotional_Range":0.7010886899,
"Conversation":0.2547882803,
"Openness to Change":0.4846609371,
"Hedonism":0.2265744616,
"Self-enhancement":0.4299178279,
"Self-transcendence":0.3220190548,
"n":80.0
},
"max":{
"Openness":0.95992792,
"Conscientousness":0.960118167,
"Extraversion":0.9794365923,
"Agreeableness":0.8993661095,
"Emotional_Range":0.9415769334,
"Conversation":0.7793932512,
"Openness to Change":0.7557249986,
"Hedonism":0.680102991,
"Self-enhancement":0.7826336181,
"Self-transcendence":0.6273682888,
"n":313.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 values of Openness to Change across all professions?
# 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 values of Openness to Change across all professions?
df.columns = ['Profession', 'Openness', 'Conscientousness', 'Extraversion', 'Agreeableness', 'Emotional_Range', 'Conversation', 'Openness to Change', 'Hedonism', 'Self-enhancement', 'Self-transcendence', 'n']
# Expected output type: is list[number], this will be checked.
return | 20250129013716 |
57 | List the bottom 4 Emotional_Range values. | 052_Professional | dev | list[number] | ['Emotional_Range'] | 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": "Profession",
"type": "category"
},
{
"name": "Openness",
"type": "float64"
},
{
"name": "Conscientousness",
"type": "float64"
},
{
"name": "Extraversion",
"type": "float64"
},
{
"name": "Agreeableness",
"type": "float64"
},
{
"name": "Emotional_Range",
"type": "float64"
},
{
"name": "Conversation",
"type": "float64"
},
{
"name": "Openness to Change",
"type": "float64"
},
{
"name": "Hedonism",
"type": "float64"
},
{
"name": "Self-enhancement",
"type": "float64"
},
{
"name": "Self-transcendence",
"type": "float64"
},
{
"name": "n",
"type": "uint16"
}
]
}
# Description of dataframe columns.
df_descrption = {
"count":{
"Openness":1227.0,
"Conscientousness":1227.0,
"Extraversion":1227.0,
"Agreeableness":1227.0,
"Emotional_Range":1227.0,
"Conversation":1227.0,
"Openness to Change":1227.0,
"Hedonism":1227.0,
"Self-enhancement":1227.0,
"Self-transcendence":1227.0,
"n":1227.0
},
"mean":{
"Openness":0.6818599599,
"Conscientousness":0.5494864934,
"Extraversion":0.5999407609,
"Agreeableness":0.3300650815,
"Emotional_Range":0.6150157566,
"Conversation":0.1954283756,
"Openness to Change":0.4297269623,
"Hedonism":0.1854087597,
"Self-enhancement":0.3530469421,
"Self-transcendence":0.2674535075,
"n":82.4392828036
},
"std":{
"Openness":0.1062055359,
"Conscientousness":0.1504663216,
"Extraversion":0.1730540692,
"Agreeableness":0.1775762646,
"Emotional_Range":0.1320494061,
"Conversation":0.1168313736,
"Openness to Change":0.0884607635,
"Hedonism":0.101973799,
"Self-enhancement":0.1235634015,
"Self-transcendence":0.098292791,
"n":25.8098237833
},
"min":{
"Openness":0.2152542646,
"Conscientousness":0.1085605602,
"Extraversion":0.1022540075,
"Agreeableness":0.017733368,
"Emotional_Range":0.165238157,
"Conversation":0.0124883557,
"Openness to Change":0.1470387283,
"Hedonism":0.0290857203,
"Self-enhancement":0.0298680791,
"Self-transcendence":0.0353641396,
"n":50.0
},
"25%":{
"Openness":0.6159645036,
"Conscientousness":0.453015216,
"Extraversion":0.5015413749,
"Agreeableness":0.1927662685,
"Emotional_Range":0.5281815531,
"Conversation":0.1087056755,
"Openness to Change":0.3720593776,
"Hedonism":0.1141935636,
"Self-enhancement":0.2732188024,
"Self-transcendence":0.2014597353,
"n":72.0
},
"50%":{
"Openness":0.6877670374,
"Conscientousness":0.5529477526,
"Extraversion":0.6337253665,
"Agreeableness":0.3236347592,
"Emotional_Range":0.6168124863,
"Conversation":0.1734567056,
"Openness to Change":0.430397799,
"Hedonism":0.158430861,
"Self-enhancement":0.3399782773,
"Self-transcendence":0.2556183242,
"n":76.0
},
"75%":{
"Openness":0.7561884082,
"Conscientousness":0.6510142733,
"Extraversion":0.7274713099,
"Agreeableness":0.4492181284,
"Emotional_Range":0.7010886899,
"Conversation":0.2547882803,
"Openness to Change":0.4846609371,
"Hedonism":0.2265744616,
"Self-enhancement":0.4299178279,
"Self-transcendence":0.3220190548,
"n":80.0
},
"max":{
"Openness":0.95992792,
"Conscientousness":0.960118167,
"Extraversion":0.9794365923,
"Agreeableness":0.8993661095,
"Emotional_Range":0.9415769334,
"Conversation":0.7793932512,
"Openness to Change":0.7557249986,
"Hedonism":0.680102991,
"Self-enhancement":0.7826336181,
"Self-transcendence":0.6273682888,
"n":313.0
}
}
# Randome sample of 10 rows from the dataframe.
df_random_sample = {
"count":{
"Openness":1227.0,
"Conscientousness":1227.0,
"Extraversion":1227.0,
"Agreeableness":1227.0,
"Emotional_Range":1227.0,
"Conversation":1227.0,
"Openness to Change":1227.0,
"Hedonism":1227.0,
"Self-enhancement":1227.0,
"Self-transcendence":1227.0,
"n":1227.0
},
"mean":{
"Openness":0.6818599599,
"Conscientousness":0.5494864934,
"Extraversion":0.5999407609,
"Agreeableness":0.3300650815,
"Emotional_Range":0.6150157566,
"Conversation":0.1954283756,
"Openness to Change":0.4297269623,
"Hedonism":0.1854087597,
"Self-enhancement":0.3530469421,
"Self-transcendence":0.2674535075,
"n":82.4392828036
},
"std":{
"Openness":0.1062055359,
"Conscientousness":0.1504663216,
"Extraversion":0.1730540692,
"Agreeableness":0.1775762646,
"Emotional_Range":0.1320494061,
"Conversation":0.1168313736,
"Openness to Change":0.0884607635,
"Hedonism":0.101973799,
"Self-enhancement":0.1235634015,
"Self-transcendence":0.098292791,
"n":25.8098237833
},
"min":{
"Openness":0.2152542646,
"Conscientousness":0.1085605602,
"Extraversion":0.1022540075,
"Agreeableness":0.017733368,
"Emotional_Range":0.165238157,
"Conversation":0.0124883557,
"Openness to Change":0.1470387283,
"Hedonism":0.0290857203,
"Self-enhancement":0.0298680791,
"Self-transcendence":0.0353641396,
"n":50.0
},
"25%":{
"Openness":0.6159645036,
"Conscientousness":0.453015216,
"Extraversion":0.5015413749,
"Agreeableness":0.1927662685,
"Emotional_Range":0.5281815531,
"Conversation":0.1087056755,
"Openness to Change":0.3720593776,
"Hedonism":0.1141935636,
"Self-enhancement":0.2732188024,
"Self-transcendence":0.2014597353,
"n":72.0
},
"50%":{
"Openness":0.6877670374,
"Conscientousness":0.5529477526,
"Extraversion":0.6337253665,
"Agreeableness":0.3236347592,
"Emotional_Range":0.6168124863,
"Conversation":0.1734567056,
"Openness to Change":0.430397799,
"Hedonism":0.158430861,
"Self-enhancement":0.3399782773,
"Self-transcendence":0.2556183242,
"n":76.0
},
"75%":{
"Openness":0.7561884082,
"Conscientousness":0.6510142733,
"Extraversion":0.7274713099,
"Agreeableness":0.4492181284,
"Emotional_Range":0.7010886899,
"Conversation":0.2547882803,
"Openness to Change":0.4846609371,
"Hedonism":0.2265744616,
"Self-enhancement":0.4299178279,
"Self-transcendence":0.3220190548,
"n":80.0
},
"max":{
"Openness":0.95992792,
"Conscientousness":0.960118167,
"Extraversion":0.9794365923,
"Agreeableness":0.8993661095,
"Emotional_Range":0.9415769334,
"Conversation":0.7793932512,
"Openness to Change":0.7557249986,
"Hedonism":0.680102991,
"Self-enhancement":0.7826336181,
"Self-transcendence":0.6273682888,
"n":313.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 bottom 4 Emotional_Range values.
# 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 bottom 4 Emotional_Range values.
df.columns = ['Profession', 'Openness', 'Conscientousness', 'Extraversion', 'Agreeableness', 'Emotional_Range', 'Conversation', 'Openness to Change', 'Hedonism', 'Self-enhancement', 'Self-transcendence', 'n']
# Expected output type: is list[number], this will be checked.
return | 20250129013716 |
58 | What are the highest 5 levels of Extraversion? | 052_Professional | dev | list[number] | ['Extraversion'] | 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": "Profession",
"type": "category"
},
{
"name": "Openness",
"type": "float64"
},
{
"name": "Conscientousness",
"type": "float64"
},
{
"name": "Extraversion",
"type": "float64"
},
{
"name": "Agreeableness",
"type": "float64"
},
{
"name": "Emotional_Range",
"type": "float64"
},
{
"name": "Conversation",
"type": "float64"
},
{
"name": "Openness to Change",
"type": "float64"
},
{
"name": "Hedonism",
"type": "float64"
},
{
"name": "Self-enhancement",
"type": "float64"
},
{
"name": "Self-transcendence",
"type": "float64"
},
{
"name": "n",
"type": "uint16"
}
]
}
# Description of dataframe columns.
df_descrption = {
"count":{
"Openness":1227.0,
"Conscientousness":1227.0,
"Extraversion":1227.0,
"Agreeableness":1227.0,
"Emotional_Range":1227.0,
"Conversation":1227.0,
"Openness to Change":1227.0,
"Hedonism":1227.0,
"Self-enhancement":1227.0,
"Self-transcendence":1227.0,
"n":1227.0
},
"mean":{
"Openness":0.6818599599,
"Conscientousness":0.5494864934,
"Extraversion":0.5999407609,
"Agreeableness":0.3300650815,
"Emotional_Range":0.6150157566,
"Conversation":0.1954283756,
"Openness to Change":0.4297269623,
"Hedonism":0.1854087597,
"Self-enhancement":0.3530469421,
"Self-transcendence":0.2674535075,
"n":82.4392828036
},
"std":{
"Openness":0.1062055359,
"Conscientousness":0.1504663216,
"Extraversion":0.1730540692,
"Agreeableness":0.1775762646,
"Emotional_Range":0.1320494061,
"Conversation":0.1168313736,
"Openness to Change":0.0884607635,
"Hedonism":0.101973799,
"Self-enhancement":0.1235634015,
"Self-transcendence":0.098292791,
"n":25.8098237833
},
"min":{
"Openness":0.2152542646,
"Conscientousness":0.1085605602,
"Extraversion":0.1022540075,
"Agreeableness":0.017733368,
"Emotional_Range":0.165238157,
"Conversation":0.0124883557,
"Openness to Change":0.1470387283,
"Hedonism":0.0290857203,
"Self-enhancement":0.0298680791,
"Self-transcendence":0.0353641396,
"n":50.0
},
"25%":{
"Openness":0.6159645036,
"Conscientousness":0.453015216,
"Extraversion":0.5015413749,
"Agreeableness":0.1927662685,
"Emotional_Range":0.5281815531,
"Conversation":0.1087056755,
"Openness to Change":0.3720593776,
"Hedonism":0.1141935636,
"Self-enhancement":0.2732188024,
"Self-transcendence":0.2014597353,
"n":72.0
},
"50%":{
"Openness":0.6877670374,
"Conscientousness":0.5529477526,
"Extraversion":0.6337253665,
"Agreeableness":0.3236347592,
"Emotional_Range":0.6168124863,
"Conversation":0.1734567056,
"Openness to Change":0.430397799,
"Hedonism":0.158430861,
"Self-enhancement":0.3399782773,
"Self-transcendence":0.2556183242,
"n":76.0
},
"75%":{
"Openness":0.7561884082,
"Conscientousness":0.6510142733,
"Extraversion":0.7274713099,
"Agreeableness":0.4492181284,
"Emotional_Range":0.7010886899,
"Conversation":0.2547882803,
"Openness to Change":0.4846609371,
"Hedonism":0.2265744616,
"Self-enhancement":0.4299178279,
"Self-transcendence":0.3220190548,
"n":80.0
},
"max":{
"Openness":0.95992792,
"Conscientousness":0.960118167,
"Extraversion":0.9794365923,
"Agreeableness":0.8993661095,
"Emotional_Range":0.9415769334,
"Conversation":0.7793932512,
"Openness to Change":0.7557249986,
"Hedonism":0.680102991,
"Self-enhancement":0.7826336181,
"Self-transcendence":0.6273682888,
"n":313.0
}
}
# Randome sample of 10 rows from the dataframe.
df_random_sample = {
"count":{
"Openness":1227.0,
"Conscientousness":1227.0,
"Extraversion":1227.0,
"Agreeableness":1227.0,
"Emotional_Range":1227.0,
"Conversation":1227.0,
"Openness to Change":1227.0,
"Hedonism":1227.0,
"Self-enhancement":1227.0,
"Self-transcendence":1227.0,
"n":1227.0
},
"mean":{
"Openness":0.6818599599,
"Conscientousness":0.5494864934,
"Extraversion":0.5999407609,
"Agreeableness":0.3300650815,
"Emotional_Range":0.6150157566,
"Conversation":0.1954283756,
"Openness to Change":0.4297269623,
"Hedonism":0.1854087597,
"Self-enhancement":0.3530469421,
"Self-transcendence":0.2674535075,
"n":82.4392828036
},
"std":{
"Openness":0.1062055359,
"Conscientousness":0.1504663216,
"Extraversion":0.1730540692,
"Agreeableness":0.1775762646,
"Emotional_Range":0.1320494061,
"Conversation":0.1168313736,
"Openness to Change":0.0884607635,
"Hedonism":0.101973799,
"Self-enhancement":0.1235634015,
"Self-transcendence":0.098292791,
"n":25.8098237833
},
"min":{
"Openness":0.2152542646,
"Conscientousness":0.1085605602,
"Extraversion":0.1022540075,
"Agreeableness":0.017733368,
"Emotional_Range":0.165238157,
"Conversation":0.0124883557,
"Openness to Change":0.1470387283,
"Hedonism":0.0290857203,
"Self-enhancement":0.0298680791,
"Self-transcendence":0.0353641396,
"n":50.0
},
"25%":{
"Openness":0.6159645036,
"Conscientousness":0.453015216,
"Extraversion":0.5015413749,
"Agreeableness":0.1927662685,
"Emotional_Range":0.5281815531,
"Conversation":0.1087056755,
"Openness to Change":0.3720593776,
"Hedonism":0.1141935636,
"Self-enhancement":0.2732188024,
"Self-transcendence":0.2014597353,
"n":72.0
},
"50%":{
"Openness":0.6877670374,
"Conscientousness":0.5529477526,
"Extraversion":0.6337253665,
"Agreeableness":0.3236347592,
"Emotional_Range":0.6168124863,
"Conversation":0.1734567056,
"Openness to Change":0.430397799,
"Hedonism":0.158430861,
"Self-enhancement":0.3399782773,
"Self-transcendence":0.2556183242,
"n":76.0
},
"75%":{
"Openness":0.7561884082,
"Conscientousness":0.6510142733,
"Extraversion":0.7274713099,
"Agreeableness":0.4492181284,
"Emotional_Range":0.7010886899,
"Conversation":0.2547882803,
"Openness to Change":0.4846609371,
"Hedonism":0.2265744616,
"Self-enhancement":0.4299178279,
"Self-transcendence":0.3220190548,
"n":80.0
},
"max":{
"Openness":0.95992792,
"Conscientousness":0.960118167,
"Extraversion":0.9794365923,
"Agreeableness":0.8993661095,
"Emotional_Range":0.9415769334,
"Conversation":0.7793932512,
"Openness to Change":0.7557249986,
"Hedonism":0.680102991,
"Self-enhancement":0.7826336181,
"Self-transcendence":0.6273682888,
"n":313.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 levels of Extraversion?
# 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 levels of Extraversion?
df.columns = ['Profession', 'Openness', 'Conscientousness', 'Extraversion', 'Agreeableness', 'Emotional_Range', 'Conversation', 'Openness to Change', 'Hedonism', 'Self-enhancement', 'Self-transcendence', 'n']
# Expected output type: is list[number], this will be checked.
return | 20250129013716 |
59 | Name the lowest 6 levels of Self-transcendence. | 052_Professional | dev | list[number] | ['Self-transcendence'] | 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": "Profession",
"type": "category"
},
{
"name": "Openness",
"type": "float64"
},
{
"name": "Conscientousness",
"type": "float64"
},
{
"name": "Extraversion",
"type": "float64"
},
{
"name": "Agreeableness",
"type": "float64"
},
{
"name": "Emotional_Range",
"type": "float64"
},
{
"name": "Conversation",
"type": "float64"
},
{
"name": "Openness to Change",
"type": "float64"
},
{
"name": "Hedonism",
"type": "float64"
},
{
"name": "Self-enhancement",
"type": "float64"
},
{
"name": "Self-transcendence",
"type": "float64"
},
{
"name": "n",
"type": "uint16"
}
]
}
# Description of dataframe columns.
df_descrption = {
"count":{
"Openness":1227.0,
"Conscientousness":1227.0,
"Extraversion":1227.0,
"Agreeableness":1227.0,
"Emotional_Range":1227.0,
"Conversation":1227.0,
"Openness to Change":1227.0,
"Hedonism":1227.0,
"Self-enhancement":1227.0,
"Self-transcendence":1227.0,
"n":1227.0
},
"mean":{
"Openness":0.6818599599,
"Conscientousness":0.5494864934,
"Extraversion":0.5999407609,
"Agreeableness":0.3300650815,
"Emotional_Range":0.6150157566,
"Conversation":0.1954283756,
"Openness to Change":0.4297269623,
"Hedonism":0.1854087597,
"Self-enhancement":0.3530469421,
"Self-transcendence":0.2674535075,
"n":82.4392828036
},
"std":{
"Openness":0.1062055359,
"Conscientousness":0.1504663216,
"Extraversion":0.1730540692,
"Agreeableness":0.1775762646,
"Emotional_Range":0.1320494061,
"Conversation":0.1168313736,
"Openness to Change":0.0884607635,
"Hedonism":0.101973799,
"Self-enhancement":0.1235634015,
"Self-transcendence":0.098292791,
"n":25.8098237833
},
"min":{
"Openness":0.2152542646,
"Conscientousness":0.1085605602,
"Extraversion":0.1022540075,
"Agreeableness":0.017733368,
"Emotional_Range":0.165238157,
"Conversation":0.0124883557,
"Openness to Change":0.1470387283,
"Hedonism":0.0290857203,
"Self-enhancement":0.0298680791,
"Self-transcendence":0.0353641396,
"n":50.0
},
"25%":{
"Openness":0.6159645036,
"Conscientousness":0.453015216,
"Extraversion":0.5015413749,
"Agreeableness":0.1927662685,
"Emotional_Range":0.5281815531,
"Conversation":0.1087056755,
"Openness to Change":0.3720593776,
"Hedonism":0.1141935636,
"Self-enhancement":0.2732188024,
"Self-transcendence":0.2014597353,
"n":72.0
},
"50%":{
"Openness":0.6877670374,
"Conscientousness":0.5529477526,
"Extraversion":0.6337253665,
"Agreeableness":0.3236347592,
"Emotional_Range":0.6168124863,
"Conversation":0.1734567056,
"Openness to Change":0.430397799,
"Hedonism":0.158430861,
"Self-enhancement":0.3399782773,
"Self-transcendence":0.2556183242,
"n":76.0
},
"75%":{
"Openness":0.7561884082,
"Conscientousness":0.6510142733,
"Extraversion":0.7274713099,
"Agreeableness":0.4492181284,
"Emotional_Range":0.7010886899,
"Conversation":0.2547882803,
"Openness to Change":0.4846609371,
"Hedonism":0.2265744616,
"Self-enhancement":0.4299178279,
"Self-transcendence":0.3220190548,
"n":80.0
},
"max":{
"Openness":0.95992792,
"Conscientousness":0.960118167,
"Extraversion":0.9794365923,
"Agreeableness":0.8993661095,
"Emotional_Range":0.9415769334,
"Conversation":0.7793932512,
"Openness to Change":0.7557249986,
"Hedonism":0.680102991,
"Self-enhancement":0.7826336181,
"Self-transcendence":0.6273682888,
"n":313.0
}
}
# Randome sample of 10 rows from the dataframe.
df_random_sample = {
"count":{
"Openness":1227.0,
"Conscientousness":1227.0,
"Extraversion":1227.0,
"Agreeableness":1227.0,
"Emotional_Range":1227.0,
"Conversation":1227.0,
"Openness to Change":1227.0,
"Hedonism":1227.0,
"Self-enhancement":1227.0,
"Self-transcendence":1227.0,
"n":1227.0
},
"mean":{
"Openness":0.6818599599,
"Conscientousness":0.5494864934,
"Extraversion":0.5999407609,
"Agreeableness":0.3300650815,
"Emotional_Range":0.6150157566,
"Conversation":0.1954283756,
"Openness to Change":0.4297269623,
"Hedonism":0.1854087597,
"Self-enhancement":0.3530469421,
"Self-transcendence":0.2674535075,
"n":82.4392828036
},
"std":{
"Openness":0.1062055359,
"Conscientousness":0.1504663216,
"Extraversion":0.1730540692,
"Agreeableness":0.1775762646,
"Emotional_Range":0.1320494061,
"Conversation":0.1168313736,
"Openness to Change":0.0884607635,
"Hedonism":0.101973799,
"Self-enhancement":0.1235634015,
"Self-transcendence":0.098292791,
"n":25.8098237833
},
"min":{
"Openness":0.2152542646,
"Conscientousness":0.1085605602,
"Extraversion":0.1022540075,
"Agreeableness":0.017733368,
"Emotional_Range":0.165238157,
"Conversation":0.0124883557,
"Openness to Change":0.1470387283,
"Hedonism":0.0290857203,
"Self-enhancement":0.0298680791,
"Self-transcendence":0.0353641396,
"n":50.0
},
"25%":{
"Openness":0.6159645036,
"Conscientousness":0.453015216,
"Extraversion":0.5015413749,
"Agreeableness":0.1927662685,
"Emotional_Range":0.5281815531,
"Conversation":0.1087056755,
"Openness to Change":0.3720593776,
"Hedonism":0.1141935636,
"Self-enhancement":0.2732188024,
"Self-transcendence":0.2014597353,
"n":72.0
},
"50%":{
"Openness":0.6877670374,
"Conscientousness":0.5529477526,
"Extraversion":0.6337253665,
"Agreeableness":0.3236347592,
"Emotional_Range":0.6168124863,
"Conversation":0.1734567056,
"Openness to Change":0.430397799,
"Hedonism":0.158430861,
"Self-enhancement":0.3399782773,
"Self-transcendence":0.2556183242,
"n":76.0
},
"75%":{
"Openness":0.7561884082,
"Conscientousness":0.6510142733,
"Extraversion":0.7274713099,
"Agreeableness":0.4492181284,
"Emotional_Range":0.7010886899,
"Conversation":0.2547882803,
"Openness to Change":0.4846609371,
"Hedonism":0.2265744616,
"Self-enhancement":0.4299178279,
"Self-transcendence":0.3220190548,
"n":80.0
},
"max":{
"Openness":0.95992792,
"Conscientousness":0.960118167,
"Extraversion":0.9794365923,
"Agreeableness":0.8993661095,
"Emotional_Range":0.9415769334,
"Conversation":0.7793932512,
"Openness to Change":0.7557249986,
"Hedonism":0.680102991,
"Self-enhancement":0.7826336181,
"Self-transcendence":0.6273682888,
"n":313.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 6 levels of Self-transcendence.
# 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 6 levels of Self-transcendence.
df.columns = ['Profession', 'Openness', 'Conscientousness', 'Extraversion', 'Agreeableness', 'Emotional_Range', 'Conversation', 'Openness to Change', 'Hedonism', 'Self-enhancement', 'Self-transcendence', 'n']
# Expected output type: is list[number], this will be checked.
return | 20250129013716 |
60 | Is there a patent containing the word 'communication' in the title? | 053_Patents | dev | boolean | ['title'] | 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": "num_claims",
"type": "uint8"
},
{
"name": "organization",
"type": "category"
},
{
"name": "kind",
"type": "category"
},
{
"name": "type",
"type": "category"
},
{
"name": "graphext_cluster",
"type": "category"
},
{
"name": "date",
"type": "datetime64[ns, UTC]"
},
{
"name": "abstract",
"type": "object"
},
{
"name": "title",
"type": "object"
},
{
"name": "lang",
"type": "category"
},
{
"name": "abstract_gx_ADJ",
"type": "object"
},
{
"name": "grp_title",
"type": "object"
},
{
"name": "abstract_gx_products",
"type": "object"
},
{
"name": "abstract_gx_organizations",
"type": "object"
},
{
"name": "abstract_gx_NOUN",
"type": "object"
},
{
"name": "abstract_gx_ngrams",
"type": "object"
},
{
"name": "id",
"type": "float64"
},
{
"name": "target",
"type": "object"
},
{
"name": "weight",
"type": "object"
},
{
"name": "x",
"type": "float64"
},
{
"name": "y",
"type": "float64"
}
]
}
# Description of dataframe columns.
df_descrption = {
"count":{
"num_claims":9999.0,
"id":8848.0,
"x":9999.0,
"y":9999.0
},
"mean":{
"num_claims":14.7459745975,
"id":9317464.8445976488,
"x":-21.058669389,
"y":-18.042839032
},
"std":{
"num_claims":9.4629164059,
"id":58501.3326715985,
"x":2061.5828151519,
"y":2228.8382538597
},
"min":{
"num_claims":1.0,
"id":9245593.0,
"x":-5218.812,
"y":-4434.756
},
"25%":{
"num_claims":8.0,
"id":9320245.75,
"x":-1388.8531,
"y":-2154.51215
},
"50%":{
"num_claims":15.0,
"id":9322341.5,
"x":-77.67177,
"y":558.54065
},
"75%":{
"num_claims":20.0,
"id":9324494.25,
"x":1270.54565,
"y":1802.24125
},
"max":{
"num_claims":100.0,
"id":9480195.0,
"x":4113.4414,
"y":3986.0618
}
}
# Randome sample of 10 rows from the dataframe.
df_random_sample = {
"count":{
"num_claims":9999.0,
"id":8848.0,
"x":9999.0,
"y":9999.0
},
"mean":{
"num_claims":14.7459745975,
"id":9317464.8445976488,
"x":-21.058669389,
"y":-18.042839032
},
"std":{
"num_claims":9.4629164059,
"id":58501.3326715985,
"x":2061.5828151519,
"y":2228.8382538597
},
"min":{
"num_claims":1.0,
"id":9245593.0,
"x":-5218.812,
"y":-4434.756
},
"25%":{
"num_claims":8.0,
"id":9320245.75,
"x":-1388.8531,
"y":-2154.51215
},
"50%":{
"num_claims":15.0,
"id":9322341.5,
"x":-77.67177,
"y":558.54065
},
"75%":{
"num_claims":20.0,
"id":9324494.25,
"x":1270.54565,
"y":1802.24125
},
"max":{
"num_claims":100.0,
"id":9480195.0,
"x":4113.4414,
"y":3986.0618
}
}
'''
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 a patent containing the word 'communication' in the title?
# 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 a patent containing the word 'communication' in the title?
df.columns = ['num_claims', 'organization', 'kind', 'type', 'graphext_cluster', 'date', 'abstract', 'title', 'lang', 'abstract_gx_ADJ', 'grp_title', 'abstract_gx_products', 'abstract_gx_organizations', 'abstract_gx_NOUN', 'abstract_gx_ngrams', 'id', 'target', 'weight', 'x', 'y']
# Expected output type: is boolean, this will be checked.
return | 20250129013716 |
61 | Are there patents associated with the organization 'IBM'? | 053_Patents | dev | boolean | ['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": "num_claims",
"type": "uint8"
},
{
"name": "organization",
"type": "category"
},
{
"name": "kind",
"type": "category"
},
{
"name": "type",
"type": "category"
},
{
"name": "graphext_cluster",
"type": "category"
},
{
"name": "date",
"type": "datetime64[ns, UTC]"
},
{
"name": "abstract",
"type": "object"
},
{
"name": "title",
"type": "object"
},
{
"name": "lang",
"type": "category"
},
{
"name": "abstract_gx_ADJ",
"type": "object"
},
{
"name": "grp_title",
"type": "object"
},
{
"name": "abstract_gx_products",
"type": "object"
},
{
"name": "abstract_gx_organizations",
"type": "object"
},
{
"name": "abstract_gx_NOUN",
"type": "object"
},
{
"name": "abstract_gx_ngrams",
"type": "object"
},
{
"name": "id",
"type": "float64"
},
{
"name": "target",
"type": "object"
},
{
"name": "weight",
"type": "object"
},
{
"name": "x",
"type": "float64"
},
{
"name": "y",
"type": "float64"
}
]
}
# Description of dataframe columns.
df_descrption = {
"count":{
"num_claims":9999.0,
"id":8848.0,
"x":9999.0,
"y":9999.0
},
"mean":{
"num_claims":14.7459745975,
"id":9317464.8445976488,
"x":-21.058669389,
"y":-18.042839032
},
"std":{
"num_claims":9.4629164059,
"id":58501.3326715985,
"x":2061.5828151519,
"y":2228.8382538597
},
"min":{
"num_claims":1.0,
"id":9245593.0,
"x":-5218.812,
"y":-4434.756
},
"25%":{
"num_claims":8.0,
"id":9320245.75,
"x":-1388.8531,
"y":-2154.51215
},
"50%":{
"num_claims":15.0,
"id":9322341.5,
"x":-77.67177,
"y":558.54065
},
"75%":{
"num_claims":20.0,
"id":9324494.25,
"x":1270.54565,
"y":1802.24125
},
"max":{
"num_claims":100.0,
"id":9480195.0,
"x":4113.4414,
"y":3986.0618
}
}
# Randome sample of 10 rows from the dataframe.
df_random_sample = {
"count":{
"num_claims":9999.0,
"id":8848.0,
"x":9999.0,
"y":9999.0
},
"mean":{
"num_claims":14.7459745975,
"id":9317464.8445976488,
"x":-21.058669389,
"y":-18.042839032
},
"std":{
"num_claims":9.4629164059,
"id":58501.3326715985,
"x":2061.5828151519,
"y":2228.8382538597
},
"min":{
"num_claims":1.0,
"id":9245593.0,
"x":-5218.812,
"y":-4434.756
},
"25%":{
"num_claims":8.0,
"id":9320245.75,
"x":-1388.8531,
"y":-2154.51215
},
"50%":{
"num_claims":15.0,
"id":9322341.5,
"x":-77.67177,
"y":558.54065
},
"75%":{
"num_claims":20.0,
"id":9324494.25,
"x":1270.54565,
"y":1802.24125
},
"max":{
"num_claims":100.0,
"id":9480195.0,
"x":4113.4414,
"y":3986.0618
}
}
'''
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 patents associated with the organization 'IBM'?
# 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 patents associated with the organization 'IBM'?
df.columns = ['num_claims', 'organization', 'kind', 'type', 'graphext_cluster', 'date', 'abstract', 'title', 'lang', 'abstract_gx_ADJ', 'grp_title', 'abstract_gx_products', 'abstract_gx_organizations', 'abstract_gx_NOUN', 'abstract_gx_ngrams', 'id', 'target', 'weight', 'x', 'y']
# Expected output type: is boolean, this will be checked.
return | 20250129013716 |
62 | Is there a patent abstract that mentions 'software'? | 053_Patents | dev | boolean | ['abstract'] | 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": "num_claims",
"type": "uint8"
},
{
"name": "organization",
"type": "category"
},
{
"name": "kind",
"type": "category"
},
{
"name": "type",
"type": "category"
},
{
"name": "graphext_cluster",
"type": "category"
},
{
"name": "date",
"type": "datetime64[ns, UTC]"
},
{
"name": "abstract",
"type": "object"
},
{
"name": "title",
"type": "object"
},
{
"name": "lang",
"type": "category"
},
{
"name": "abstract_gx_ADJ",
"type": "object"
},
{
"name": "grp_title",
"type": "object"
},
{
"name": "abstract_gx_products",
"type": "object"
},
{
"name": "abstract_gx_organizations",
"type": "object"
},
{
"name": "abstract_gx_NOUN",
"type": "object"
},
{
"name": "abstract_gx_ngrams",
"type": "object"
},
{
"name": "id",
"type": "float64"
},
{
"name": "target",
"type": "object"
},
{
"name": "weight",
"type": "object"
},
{
"name": "x",
"type": "float64"
},
{
"name": "y",
"type": "float64"
}
]
}
# Description of dataframe columns.
df_descrption = {
"count":{
"num_claims":9999.0,
"id":8848.0,
"x":9999.0,
"y":9999.0
},
"mean":{
"num_claims":14.7459745975,
"id":9317464.8445976488,
"x":-21.058669389,
"y":-18.042839032
},
"std":{
"num_claims":9.4629164059,
"id":58501.3326715985,
"x":2061.5828151519,
"y":2228.8382538597
},
"min":{
"num_claims":1.0,
"id":9245593.0,
"x":-5218.812,
"y":-4434.756
},
"25%":{
"num_claims":8.0,
"id":9320245.75,
"x":-1388.8531,
"y":-2154.51215
},
"50%":{
"num_claims":15.0,
"id":9322341.5,
"x":-77.67177,
"y":558.54065
},
"75%":{
"num_claims":20.0,
"id":9324494.25,
"x":1270.54565,
"y":1802.24125
},
"max":{
"num_claims":100.0,
"id":9480195.0,
"x":4113.4414,
"y":3986.0618
}
}
# Randome sample of 10 rows from the dataframe.
df_random_sample = {
"count":{
"num_claims":9999.0,
"id":8848.0,
"x":9999.0,
"y":9999.0
},
"mean":{
"num_claims":14.7459745975,
"id":9317464.8445976488,
"x":-21.058669389,
"y":-18.042839032
},
"std":{
"num_claims":9.4629164059,
"id":58501.3326715985,
"x":2061.5828151519,
"y":2228.8382538597
},
"min":{
"num_claims":1.0,
"id":9245593.0,
"x":-5218.812,
"y":-4434.756
},
"25%":{
"num_claims":8.0,
"id":9320245.75,
"x":-1388.8531,
"y":-2154.51215
},
"50%":{
"num_claims":15.0,
"id":9322341.5,
"x":-77.67177,
"y":558.54065
},
"75%":{
"num_claims":20.0,
"id":9324494.25,
"x":1270.54565,
"y":1802.24125
},
"max":{
"num_claims":100.0,
"id":9480195.0,
"x":4113.4414,
"y":3986.0618
}
}
'''
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 a patent abstract that mentions 'software'?
# 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 a patent abstract that mentions 'software'?
df.columns = ['num_claims', 'organization', 'kind', 'type', 'graphext_cluster', 'date', 'abstract', 'title', 'lang', 'abstract_gx_ADJ', 'grp_title', 'abstract_gx_products', 'abstract_gx_organizations', 'abstract_gx_NOUN', 'abstract_gx_ngrams', 'id', 'target', 'weight', 'x', 'y']
# Expected output type: is boolean, this will be checked.
return | 20250129013716 |
63 | Are there patents of the 'design' type? | 053_Patents | dev | boolean | ['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": "num_claims",
"type": "uint8"
},
{
"name": "organization",
"type": "category"
},
{
"name": "kind",
"type": "category"
},
{
"name": "type",
"type": "category"
},
{
"name": "graphext_cluster",
"type": "category"
},
{
"name": "date",
"type": "datetime64[ns, UTC]"
},
{
"name": "abstract",
"type": "object"
},
{
"name": "title",
"type": "object"
},
{
"name": "lang",
"type": "category"
},
{
"name": "abstract_gx_ADJ",
"type": "object"
},
{
"name": "grp_title",
"type": "object"
},
{
"name": "abstract_gx_products",
"type": "object"
},
{
"name": "abstract_gx_organizations",
"type": "object"
},
{
"name": "abstract_gx_NOUN",
"type": "object"
},
{
"name": "abstract_gx_ngrams",
"type": "object"
},
{
"name": "id",
"type": "float64"
},
{
"name": "target",
"type": "object"
},
{
"name": "weight",
"type": "object"
},
{
"name": "x",
"type": "float64"
},
{
"name": "y",
"type": "float64"
}
]
}
# Description of dataframe columns.
df_descrption = {
"count":{
"num_claims":9999.0,
"id":8848.0,
"x":9999.0,
"y":9999.0
},
"mean":{
"num_claims":14.7459745975,
"id":9317464.8445976488,
"x":-21.058669389,
"y":-18.042839032
},
"std":{
"num_claims":9.4629164059,
"id":58501.3326715985,
"x":2061.5828151519,
"y":2228.8382538597
},
"min":{
"num_claims":1.0,
"id":9245593.0,
"x":-5218.812,
"y":-4434.756
},
"25%":{
"num_claims":8.0,
"id":9320245.75,
"x":-1388.8531,
"y":-2154.51215
},
"50%":{
"num_claims":15.0,
"id":9322341.5,
"x":-77.67177,
"y":558.54065
},
"75%":{
"num_claims":20.0,
"id":9324494.25,
"x":1270.54565,
"y":1802.24125
},
"max":{
"num_claims":100.0,
"id":9480195.0,
"x":4113.4414,
"y":3986.0618
}
}
# Randome sample of 10 rows from the dataframe.
df_random_sample = {
"count":{
"num_claims":9999.0,
"id":8848.0,
"x":9999.0,
"y":9999.0
},
"mean":{
"num_claims":14.7459745975,
"id":9317464.8445976488,
"x":-21.058669389,
"y":-18.042839032
},
"std":{
"num_claims":9.4629164059,
"id":58501.3326715985,
"x":2061.5828151519,
"y":2228.8382538597
},
"min":{
"num_claims":1.0,
"id":9245593.0,
"x":-5218.812,
"y":-4434.756
},
"25%":{
"num_claims":8.0,
"id":9320245.75,
"x":-1388.8531,
"y":-2154.51215
},
"50%":{
"num_claims":15.0,
"id":9322341.5,
"x":-77.67177,
"y":558.54065
},
"75%":{
"num_claims":20.0,
"id":9324494.25,
"x":1270.54565,
"y":1802.24125
},
"max":{
"num_claims":100.0,
"id":9480195.0,
"x":4113.4414,
"y":3986.0618
}
}
'''
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 patents of the 'design' 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: Are there patents of the 'design' type?
df.columns = ['num_claims', 'organization', 'kind', 'type', 'graphext_cluster', 'date', 'abstract', 'title', 'lang', 'abstract_gx_ADJ', 'grp_title', 'abstract_gx_products', 'abstract_gx_organizations', 'abstract_gx_NOUN', 'abstract_gx_ngrams', 'id', 'target', 'weight', 'x', 'y']
# Expected output type: is boolean, this will be checked.
return | 20250129013716 |
64 | How many unique organizations have patents listed? | 053_Patents | dev | number | ['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": "num_claims",
"type": "uint8"
},
{
"name": "organization",
"type": "category"
},
{
"name": "kind",
"type": "category"
},
{
"name": "type",
"type": "category"
},
{
"name": "graphext_cluster",
"type": "category"
},
{
"name": "date",
"type": "datetime64[ns, UTC]"
},
{
"name": "abstract",
"type": "object"
},
{
"name": "title",
"type": "object"
},
{
"name": "lang",
"type": "category"
},
{
"name": "abstract_gx_ADJ",
"type": "object"
},
{
"name": "grp_title",
"type": "object"
},
{
"name": "abstract_gx_products",
"type": "object"
},
{
"name": "abstract_gx_organizations",
"type": "object"
},
{
"name": "abstract_gx_NOUN",
"type": "object"
},
{
"name": "abstract_gx_ngrams",
"type": "object"
},
{
"name": "id",
"type": "float64"
},
{
"name": "target",
"type": "object"
},
{
"name": "weight",
"type": "object"
},
{
"name": "x",
"type": "float64"
},
{
"name": "y",
"type": "float64"
}
]
}
# Description of dataframe columns.
df_descrption = {
"count":{
"num_claims":9999.0,
"id":8848.0,
"x":9999.0,
"y":9999.0
},
"mean":{
"num_claims":14.7459745975,
"id":9317464.8445976488,
"x":-21.058669389,
"y":-18.042839032
},
"std":{
"num_claims":9.4629164059,
"id":58501.3326715985,
"x":2061.5828151519,
"y":2228.8382538597
},
"min":{
"num_claims":1.0,
"id":9245593.0,
"x":-5218.812,
"y":-4434.756
},
"25%":{
"num_claims":8.0,
"id":9320245.75,
"x":-1388.8531,
"y":-2154.51215
},
"50%":{
"num_claims":15.0,
"id":9322341.5,
"x":-77.67177,
"y":558.54065
},
"75%":{
"num_claims":20.0,
"id":9324494.25,
"x":1270.54565,
"y":1802.24125
},
"max":{
"num_claims":100.0,
"id":9480195.0,
"x":4113.4414,
"y":3986.0618
}
}
# Randome sample of 10 rows from the dataframe.
df_random_sample = {
"count":{
"num_claims":9999.0,
"id":8848.0,
"x":9999.0,
"y":9999.0
},
"mean":{
"num_claims":14.7459745975,
"id":9317464.8445976488,
"x":-21.058669389,
"y":-18.042839032
},
"std":{
"num_claims":9.4629164059,
"id":58501.3326715985,
"x":2061.5828151519,
"y":2228.8382538597
},
"min":{
"num_claims":1.0,
"id":9245593.0,
"x":-5218.812,
"y":-4434.756
},
"25%":{
"num_claims":8.0,
"id":9320245.75,
"x":-1388.8531,
"y":-2154.51215
},
"50%":{
"num_claims":15.0,
"id":9322341.5,
"x":-77.67177,
"y":558.54065
},
"75%":{
"num_claims":20.0,
"id":9324494.25,
"x":1270.54565,
"y":1802.24125
},
"max":{
"num_claims":100.0,
"id":9480195.0,
"x":4113.4414,
"y":3986.0618
}
}
'''
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 organizations have patents listed?
# 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 organizations have patents listed?
df.columns = ['num_claims', 'organization', 'kind', 'type', 'graphext_cluster', 'date', 'abstract', 'title', 'lang', 'abstract_gx_ADJ', 'grp_title', 'abstract_gx_products', 'abstract_gx_organizations', 'abstract_gx_NOUN', 'abstract_gx_ngrams', 'id', 'target', 'weight', 'x', 'y']
# Expected output type: is number, this will be checked.
return | 20250129013716 |
65 | On average, how many claims do the patents have? | 053_Patents | dev | number | ['num_claims'] | 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": "num_claims",
"type": "uint8"
},
{
"name": "organization",
"type": "category"
},
{
"name": "kind",
"type": "category"
},
{
"name": "type",
"type": "category"
},
{
"name": "graphext_cluster",
"type": "category"
},
{
"name": "date",
"type": "datetime64[ns, UTC]"
},
{
"name": "abstract",
"type": "object"
},
{
"name": "title",
"type": "object"
},
{
"name": "lang",
"type": "category"
},
{
"name": "abstract_gx_ADJ",
"type": "object"
},
{
"name": "grp_title",
"type": "object"
},
{
"name": "abstract_gx_products",
"type": "object"
},
{
"name": "abstract_gx_organizations",
"type": "object"
},
{
"name": "abstract_gx_NOUN",
"type": "object"
},
{
"name": "abstract_gx_ngrams",
"type": "object"
},
{
"name": "id",
"type": "float64"
},
{
"name": "target",
"type": "object"
},
{
"name": "weight",
"type": "object"
},
{
"name": "x",
"type": "float64"
},
{
"name": "y",
"type": "float64"
}
]
}
# Description of dataframe columns.
df_descrption = {
"count":{
"num_claims":9999.0,
"id":8848.0,
"x":9999.0,
"y":9999.0
},
"mean":{
"num_claims":14.7459745975,
"id":9317464.8445976488,
"x":-21.058669389,
"y":-18.042839032
},
"std":{
"num_claims":9.4629164059,
"id":58501.3326715985,
"x":2061.5828151519,
"y":2228.8382538597
},
"min":{
"num_claims":1.0,
"id":9245593.0,
"x":-5218.812,
"y":-4434.756
},
"25%":{
"num_claims":8.0,
"id":9320245.75,
"x":-1388.8531,
"y":-2154.51215
},
"50%":{
"num_claims":15.0,
"id":9322341.5,
"x":-77.67177,
"y":558.54065
},
"75%":{
"num_claims":20.0,
"id":9324494.25,
"x":1270.54565,
"y":1802.24125
},
"max":{
"num_claims":100.0,
"id":9480195.0,
"x":4113.4414,
"y":3986.0618
}
}
# Randome sample of 10 rows from the dataframe.
df_random_sample = {
"count":{
"num_claims":9999.0,
"id":8848.0,
"x":9999.0,
"y":9999.0
},
"mean":{
"num_claims":14.7459745975,
"id":9317464.8445976488,
"x":-21.058669389,
"y":-18.042839032
},
"std":{
"num_claims":9.4629164059,
"id":58501.3326715985,
"x":2061.5828151519,
"y":2228.8382538597
},
"min":{
"num_claims":1.0,
"id":9245593.0,
"x":-5218.812,
"y":-4434.756
},
"25%":{
"num_claims":8.0,
"id":9320245.75,
"x":-1388.8531,
"y":-2154.51215
},
"50%":{
"num_claims":15.0,
"id":9322341.5,
"x":-77.67177,
"y":558.54065
},
"75%":{
"num_claims":20.0,
"id":9324494.25,
"x":1270.54565,
"y":1802.24125
},
"max":{
"num_claims":100.0,
"id":9480195.0,
"x":4113.4414,
"y":3986.0618
}
}
'''
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 average, how many claims do the patents 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: On average, how many claims do the patents have?
df.columns = ['num_claims', 'organization', 'kind', 'type', 'graphext_cluster', 'date', 'abstract', 'title', 'lang', 'abstract_gx_ADJ', 'grp_title', 'abstract_gx_products', 'abstract_gx_organizations', 'abstract_gx_NOUN', 'abstract_gx_ngrams', 'id', 'target', 'weight', 'x', 'y']
# Expected output type: is number, this will be checked.
return | 20250129013716 |
66 | What's the highest number of claims a patent has? | 053_Patents | dev | number | ['num_claims'] | 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": "num_claims",
"type": "uint8"
},
{
"name": "organization",
"type": "category"
},
{
"name": "kind",
"type": "category"
},
{
"name": "type",
"type": "category"
},
{
"name": "graphext_cluster",
"type": "category"
},
{
"name": "date",
"type": "datetime64[ns, UTC]"
},
{
"name": "abstract",
"type": "object"
},
{
"name": "title",
"type": "object"
},
{
"name": "lang",
"type": "category"
},
{
"name": "abstract_gx_ADJ",
"type": "object"
},
{
"name": "grp_title",
"type": "object"
},
{
"name": "abstract_gx_products",
"type": "object"
},
{
"name": "abstract_gx_organizations",
"type": "object"
},
{
"name": "abstract_gx_NOUN",
"type": "object"
},
{
"name": "abstract_gx_ngrams",
"type": "object"
},
{
"name": "id",
"type": "float64"
},
{
"name": "target",
"type": "object"
},
{
"name": "weight",
"type": "object"
},
{
"name": "x",
"type": "float64"
},
{
"name": "y",
"type": "float64"
}
]
}
# Description of dataframe columns.
df_descrption = {
"count":{
"num_claims":9999.0,
"id":8848.0,
"x":9999.0,
"y":9999.0
},
"mean":{
"num_claims":14.7459745975,
"id":9317464.8445976488,
"x":-21.058669389,
"y":-18.042839032
},
"std":{
"num_claims":9.4629164059,
"id":58501.3326715985,
"x":2061.5828151519,
"y":2228.8382538597
},
"min":{
"num_claims":1.0,
"id":9245593.0,
"x":-5218.812,
"y":-4434.756
},
"25%":{
"num_claims":8.0,
"id":9320245.75,
"x":-1388.8531,
"y":-2154.51215
},
"50%":{
"num_claims":15.0,
"id":9322341.5,
"x":-77.67177,
"y":558.54065
},
"75%":{
"num_claims":20.0,
"id":9324494.25,
"x":1270.54565,
"y":1802.24125
},
"max":{
"num_claims":100.0,
"id":9480195.0,
"x":4113.4414,
"y":3986.0618
}
}
# Randome sample of 10 rows from the dataframe.
df_random_sample = {
"count":{
"num_claims":9999.0,
"id":8848.0,
"x":9999.0,
"y":9999.0
},
"mean":{
"num_claims":14.7459745975,
"id":9317464.8445976488,
"x":-21.058669389,
"y":-18.042839032
},
"std":{
"num_claims":9.4629164059,
"id":58501.3326715985,
"x":2061.5828151519,
"y":2228.8382538597
},
"min":{
"num_claims":1.0,
"id":9245593.0,
"x":-5218.812,
"y":-4434.756
},
"25%":{
"num_claims":8.0,
"id":9320245.75,
"x":-1388.8531,
"y":-2154.51215
},
"50%":{
"num_claims":15.0,
"id":9322341.5,
"x":-77.67177,
"y":558.54065
},
"75%":{
"num_claims":20.0,
"id":9324494.25,
"x":1270.54565,
"y":1802.24125
},
"max":{
"num_claims":100.0,
"id":9480195.0,
"x":4113.4414,
"y":3986.0618
}
}
'''
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 number of claims a patent 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's the highest number of claims a patent has?
df.columns = ['num_claims', 'organization', 'kind', 'type', 'graphext_cluster', 'date', 'abstract', 'title', 'lang', 'abstract_gx_ADJ', 'grp_title', 'abstract_gx_products', 'abstract_gx_organizations', 'abstract_gx_NOUN', 'abstract_gx_ngrams', 'id', 'target', 'weight', 'x', 'y']
# Expected output type: is number, this will be checked.
return | 20250129013716 |
67 | How many patents are of 'utility' type? | 053_Patents | dev | number | ['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": "num_claims",
"type": "uint8"
},
{
"name": "organization",
"type": "category"
},
{
"name": "kind",
"type": "category"
},
{
"name": "type",
"type": "category"
},
{
"name": "graphext_cluster",
"type": "category"
},
{
"name": "date",
"type": "datetime64[ns, UTC]"
},
{
"name": "abstract",
"type": "object"
},
{
"name": "title",
"type": "object"
},
{
"name": "lang",
"type": "category"
},
{
"name": "abstract_gx_ADJ",
"type": "object"
},
{
"name": "grp_title",
"type": "object"
},
{
"name": "abstract_gx_products",
"type": "object"
},
{
"name": "abstract_gx_organizations",
"type": "object"
},
{
"name": "abstract_gx_NOUN",
"type": "object"
},
{
"name": "abstract_gx_ngrams",
"type": "object"
},
{
"name": "id",
"type": "float64"
},
{
"name": "target",
"type": "object"
},
{
"name": "weight",
"type": "object"
},
{
"name": "x",
"type": "float64"
},
{
"name": "y",
"type": "float64"
}
]
}
# Description of dataframe columns.
df_descrption = {
"count":{
"num_claims":9999.0,
"id":8848.0,
"x":9999.0,
"y":9999.0
},
"mean":{
"num_claims":14.7459745975,
"id":9317464.8445976488,
"x":-21.058669389,
"y":-18.042839032
},
"std":{
"num_claims":9.4629164059,
"id":58501.3326715985,
"x":2061.5828151519,
"y":2228.8382538597
},
"min":{
"num_claims":1.0,
"id":9245593.0,
"x":-5218.812,
"y":-4434.756
},
"25%":{
"num_claims":8.0,
"id":9320245.75,
"x":-1388.8531,
"y":-2154.51215
},
"50%":{
"num_claims":15.0,
"id":9322341.5,
"x":-77.67177,
"y":558.54065
},
"75%":{
"num_claims":20.0,
"id":9324494.25,
"x":1270.54565,
"y":1802.24125
},
"max":{
"num_claims":100.0,
"id":9480195.0,
"x":4113.4414,
"y":3986.0618
}
}
# Randome sample of 10 rows from the dataframe.
df_random_sample = {
"count":{
"num_claims":9999.0,
"id":8848.0,
"x":9999.0,
"y":9999.0
},
"mean":{
"num_claims":14.7459745975,
"id":9317464.8445976488,
"x":-21.058669389,
"y":-18.042839032
},
"std":{
"num_claims":9.4629164059,
"id":58501.3326715985,
"x":2061.5828151519,
"y":2228.8382538597
},
"min":{
"num_claims":1.0,
"id":9245593.0,
"x":-5218.812,
"y":-4434.756
},
"25%":{
"num_claims":8.0,
"id":9320245.75,
"x":-1388.8531,
"y":-2154.51215
},
"50%":{
"num_claims":15.0,
"id":9322341.5,
"x":-77.67177,
"y":558.54065
},
"75%":{
"num_claims":20.0,
"id":9324494.25,
"x":1270.54565,
"y":1802.24125
},
"max":{
"num_claims":100.0,
"id":9480195.0,
"x":4113.4414,
"y":3986.0618
}
}
'''
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 patents are of 'utility' 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: How many patents are of 'utility' type?
df.columns = ['num_claims', 'organization', 'kind', 'type', 'graphext_cluster', 'date', 'abstract', 'title', 'lang', 'abstract_gx_ADJ', 'grp_title', 'abstract_gx_products', 'abstract_gx_organizations', 'abstract_gx_NOUN', 'abstract_gx_ngrams', 'id', 'target', 'weight', 'x', 'y']
# Expected output type: is number, this will be checked.
return | 20250129013716 |
68 | Which organization has the patent with the highest number of claims? | 053_Patents | dev | category | ['organization', 'num_claims'] | 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": "num_claims",
"type": "uint8"
},
{
"name": "organization",
"type": "category"
},
{
"name": "kind",
"type": "category"
},
{
"name": "type",
"type": "category"
},
{
"name": "graphext_cluster",
"type": "category"
},
{
"name": "date",
"type": "datetime64[ns, UTC]"
},
{
"name": "abstract",
"type": "object"
},
{
"name": "title",
"type": "object"
},
{
"name": "lang",
"type": "category"
},
{
"name": "abstract_gx_ADJ",
"type": "object"
},
{
"name": "grp_title",
"type": "object"
},
{
"name": "abstract_gx_products",
"type": "object"
},
{
"name": "abstract_gx_organizations",
"type": "object"
},
{
"name": "abstract_gx_NOUN",
"type": "object"
},
{
"name": "abstract_gx_ngrams",
"type": "object"
},
{
"name": "id",
"type": "float64"
},
{
"name": "target",
"type": "object"
},
{
"name": "weight",
"type": "object"
},
{
"name": "x",
"type": "float64"
},
{
"name": "y",
"type": "float64"
}
]
}
# Description of dataframe columns.
df_descrption = {
"count":{
"num_claims":9999.0,
"id":8848.0,
"x":9999.0,
"y":9999.0
},
"mean":{
"num_claims":14.7459745975,
"id":9317464.8445976488,
"x":-21.058669389,
"y":-18.042839032
},
"std":{
"num_claims":9.4629164059,
"id":58501.3326715985,
"x":2061.5828151519,
"y":2228.8382538597
},
"min":{
"num_claims":1.0,
"id":9245593.0,
"x":-5218.812,
"y":-4434.756
},
"25%":{
"num_claims":8.0,
"id":9320245.75,
"x":-1388.8531,
"y":-2154.51215
},
"50%":{
"num_claims":15.0,
"id":9322341.5,
"x":-77.67177,
"y":558.54065
},
"75%":{
"num_claims":20.0,
"id":9324494.25,
"x":1270.54565,
"y":1802.24125
},
"max":{
"num_claims":100.0,
"id":9480195.0,
"x":4113.4414,
"y":3986.0618
}
}
# Randome sample of 10 rows from the dataframe.
df_random_sample = {
"count":{
"num_claims":9999.0,
"id":8848.0,
"x":9999.0,
"y":9999.0
},
"mean":{
"num_claims":14.7459745975,
"id":9317464.8445976488,
"x":-21.058669389,
"y":-18.042839032
},
"std":{
"num_claims":9.4629164059,
"id":58501.3326715985,
"x":2061.5828151519,
"y":2228.8382538597
},
"min":{
"num_claims":1.0,
"id":9245593.0,
"x":-5218.812,
"y":-4434.756
},
"25%":{
"num_claims":8.0,
"id":9320245.75,
"x":-1388.8531,
"y":-2154.51215
},
"50%":{
"num_claims":15.0,
"id":9322341.5,
"x":-77.67177,
"y":558.54065
},
"75%":{
"num_claims":20.0,
"id":9324494.25,
"x":1270.54565,
"y":1802.24125
},
"max":{
"num_claims":100.0,
"id":9480195.0,
"x":4113.4414,
"y":3986.0618
}
}
'''
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 organization has the patent with the highest number of claims?
# 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 organization has the patent with the highest number of claims?
df.columns = ['num_claims', 'organization', 'kind', 'type', 'graphext_cluster', 'date', 'abstract', 'title', 'lang', 'abstract_gx_ADJ', 'grp_title', 'abstract_gx_products', 'abstract_gx_organizations', 'abstract_gx_NOUN', 'abstract_gx_ngrams', 'id', 'target', 'weight', 'x', 'y']
# Expected output type: is category, this will be checked.
return | 20250129013716 |
69 | Which kind of patent is the most common? | 053_Patents | dev | category | ['kind'] | 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": "num_claims",
"type": "uint8"
},
{
"name": "organization",
"type": "category"
},
{
"name": "kind",
"type": "category"
},
{
"name": "type",
"type": "category"
},
{
"name": "graphext_cluster",
"type": "category"
},
{
"name": "date",
"type": "datetime64[ns, UTC]"
},
{
"name": "abstract",
"type": "object"
},
{
"name": "title",
"type": "object"
},
{
"name": "lang",
"type": "category"
},
{
"name": "abstract_gx_ADJ",
"type": "object"
},
{
"name": "grp_title",
"type": "object"
},
{
"name": "abstract_gx_products",
"type": "object"
},
{
"name": "abstract_gx_organizations",
"type": "object"
},
{
"name": "abstract_gx_NOUN",
"type": "object"
},
{
"name": "abstract_gx_ngrams",
"type": "object"
},
{
"name": "id",
"type": "float64"
},
{
"name": "target",
"type": "object"
},
{
"name": "weight",
"type": "object"
},
{
"name": "x",
"type": "float64"
},
{
"name": "y",
"type": "float64"
}
]
}
# Description of dataframe columns.
df_descrption = {
"count":{
"num_claims":9999.0,
"id":8848.0,
"x":9999.0,
"y":9999.0
},
"mean":{
"num_claims":14.7459745975,
"id":9317464.8445976488,
"x":-21.058669389,
"y":-18.042839032
},
"std":{
"num_claims":9.4629164059,
"id":58501.3326715985,
"x":2061.5828151519,
"y":2228.8382538597
},
"min":{
"num_claims":1.0,
"id":9245593.0,
"x":-5218.812,
"y":-4434.756
},
"25%":{
"num_claims":8.0,
"id":9320245.75,
"x":-1388.8531,
"y":-2154.51215
},
"50%":{
"num_claims":15.0,
"id":9322341.5,
"x":-77.67177,
"y":558.54065
},
"75%":{
"num_claims":20.0,
"id":9324494.25,
"x":1270.54565,
"y":1802.24125
},
"max":{
"num_claims":100.0,
"id":9480195.0,
"x":4113.4414,
"y":3986.0618
}
}
# Randome sample of 10 rows from the dataframe.
df_random_sample = {
"count":{
"num_claims":9999.0,
"id":8848.0,
"x":9999.0,
"y":9999.0
},
"mean":{
"num_claims":14.7459745975,
"id":9317464.8445976488,
"x":-21.058669389,
"y":-18.042839032
},
"std":{
"num_claims":9.4629164059,
"id":58501.3326715985,
"x":2061.5828151519,
"y":2228.8382538597
},
"min":{
"num_claims":1.0,
"id":9245593.0,
"x":-5218.812,
"y":-4434.756
},
"25%":{
"num_claims":8.0,
"id":9320245.75,
"x":-1388.8531,
"y":-2154.51215
},
"50%":{
"num_claims":15.0,
"id":9322341.5,
"x":-77.67177,
"y":558.54065
},
"75%":{
"num_claims":20.0,
"id":9324494.25,
"x":1270.54565,
"y":1802.24125
},
"max":{
"num_claims":100.0,
"id":9480195.0,
"x":4113.4414,
"y":3986.0618
}
}
'''
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 kind of patent is the most common?
# 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 kind of patent is the most common?
df.columns = ['num_claims', 'organization', 'kind', 'type', 'graphext_cluster', 'date', 'abstract', 'title', 'lang', 'abstract_gx_ADJ', 'grp_title', 'abstract_gx_products', 'abstract_gx_organizations', 'abstract_gx_NOUN', 'abstract_gx_ngrams', 'id', 'target', 'weight', 'x', 'y']
# Expected output type: is category, this will be checked.
return | 20250129013716 |
70 | In which language are the patents written? | 053_Patents | 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": "num_claims",
"type": "uint8"
},
{
"name": "organization",
"type": "category"
},
{
"name": "kind",
"type": "category"
},
{
"name": "type",
"type": "category"
},
{
"name": "graphext_cluster",
"type": "category"
},
{
"name": "date",
"type": "datetime64[ns, UTC]"
},
{
"name": "abstract",
"type": "object"
},
{
"name": "title",
"type": "object"
},
{
"name": "lang",
"type": "category"
},
{
"name": "abstract_gx_ADJ",
"type": "object"
},
{
"name": "grp_title",
"type": "object"
},
{
"name": "abstract_gx_products",
"type": "object"
},
{
"name": "abstract_gx_organizations",
"type": "object"
},
{
"name": "abstract_gx_NOUN",
"type": "object"
},
{
"name": "abstract_gx_ngrams",
"type": "object"
},
{
"name": "id",
"type": "float64"
},
{
"name": "target",
"type": "object"
},
{
"name": "weight",
"type": "object"
},
{
"name": "x",
"type": "float64"
},
{
"name": "y",
"type": "float64"
}
]
}
# Description of dataframe columns.
df_descrption = {
"count":{
"num_claims":9999.0,
"id":8848.0,
"x":9999.0,
"y":9999.0
},
"mean":{
"num_claims":14.7459745975,
"id":9317464.8445976488,
"x":-21.058669389,
"y":-18.042839032
},
"std":{
"num_claims":9.4629164059,
"id":58501.3326715985,
"x":2061.5828151519,
"y":2228.8382538597
},
"min":{
"num_claims":1.0,
"id":9245593.0,
"x":-5218.812,
"y":-4434.756
},
"25%":{
"num_claims":8.0,
"id":9320245.75,
"x":-1388.8531,
"y":-2154.51215
},
"50%":{
"num_claims":15.0,
"id":9322341.5,
"x":-77.67177,
"y":558.54065
},
"75%":{
"num_claims":20.0,
"id":9324494.25,
"x":1270.54565,
"y":1802.24125
},
"max":{
"num_claims":100.0,
"id":9480195.0,
"x":4113.4414,
"y":3986.0618
}
}
# Randome sample of 10 rows from the dataframe.
df_random_sample = {
"count":{
"num_claims":9999.0,
"id":8848.0,
"x":9999.0,
"y":9999.0
},
"mean":{
"num_claims":14.7459745975,
"id":9317464.8445976488,
"x":-21.058669389,
"y":-18.042839032
},
"std":{
"num_claims":9.4629164059,
"id":58501.3326715985,
"x":2061.5828151519,
"y":2228.8382538597
},
"min":{
"num_claims":1.0,
"id":9245593.0,
"x":-5218.812,
"y":-4434.756
},
"25%":{
"num_claims":8.0,
"id":9320245.75,
"x":-1388.8531,
"y":-2154.51215
},
"50%":{
"num_claims":15.0,
"id":9322341.5,
"x":-77.67177,
"y":558.54065
},
"75%":{
"num_claims":20.0,
"id":9324494.25,
"x":1270.54565,
"y":1802.24125
},
"max":{
"num_claims":100.0,
"id":9480195.0,
"x":4113.4414,
"y":3986.0618
}
}
'''
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 are the patents 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 are the patents written?
df.columns = ['num_claims', 'organization', 'kind', 'type', 'graphext_cluster', 'date', 'abstract', 'title', 'lang', 'abstract_gx_ADJ', 'grp_title', 'abstract_gx_products', 'abstract_gx_organizations', 'abstract_gx_NOUN', 'abstract_gx_ngrams', 'id', 'target', 'weight', 'x', 'y']
# Expected output type: is category, this will be checked.
return | 20250129013716 |
71 | Which graphext cluster is the most common among the patents? | 053_Patents | dev | category | ['graphext_cluster'] | 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": "num_claims",
"type": "uint8"
},
{
"name": "organization",
"type": "category"
},
{
"name": "kind",
"type": "category"
},
{
"name": "type",
"type": "category"
},
{
"name": "graphext_cluster",
"type": "category"
},
{
"name": "date",
"type": "datetime64[ns, UTC]"
},
{
"name": "abstract",
"type": "object"
},
{
"name": "title",
"type": "object"
},
{
"name": "lang",
"type": "category"
},
{
"name": "abstract_gx_ADJ",
"type": "object"
},
{
"name": "grp_title",
"type": "object"
},
{
"name": "abstract_gx_products",
"type": "object"
},
{
"name": "abstract_gx_organizations",
"type": "object"
},
{
"name": "abstract_gx_NOUN",
"type": "object"
},
{
"name": "abstract_gx_ngrams",
"type": "object"
},
{
"name": "id",
"type": "float64"
},
{
"name": "target",
"type": "object"
},
{
"name": "weight",
"type": "object"
},
{
"name": "x",
"type": "float64"
},
{
"name": "y",
"type": "float64"
}
]
}
# Description of dataframe columns.
df_descrption = {
"count":{
"num_claims":9999.0,
"id":8848.0,
"x":9999.0,
"y":9999.0
},
"mean":{
"num_claims":14.7459745975,
"id":9317464.8445976488,
"x":-21.058669389,
"y":-18.042839032
},
"std":{
"num_claims":9.4629164059,
"id":58501.3326715985,
"x":2061.5828151519,
"y":2228.8382538597
},
"min":{
"num_claims":1.0,
"id":9245593.0,
"x":-5218.812,
"y":-4434.756
},
"25%":{
"num_claims":8.0,
"id":9320245.75,
"x":-1388.8531,
"y":-2154.51215
},
"50%":{
"num_claims":15.0,
"id":9322341.5,
"x":-77.67177,
"y":558.54065
},
"75%":{
"num_claims":20.0,
"id":9324494.25,
"x":1270.54565,
"y":1802.24125
},
"max":{
"num_claims":100.0,
"id":9480195.0,
"x":4113.4414,
"y":3986.0618
}
}
# Randome sample of 10 rows from the dataframe.
df_random_sample = {
"count":{
"num_claims":9999.0,
"id":8848.0,
"x":9999.0,
"y":9999.0
},
"mean":{
"num_claims":14.7459745975,
"id":9317464.8445976488,
"x":-21.058669389,
"y":-18.042839032
},
"std":{
"num_claims":9.4629164059,
"id":58501.3326715985,
"x":2061.5828151519,
"y":2228.8382538597
},
"min":{
"num_claims":1.0,
"id":9245593.0,
"x":-5218.812,
"y":-4434.756
},
"25%":{
"num_claims":8.0,
"id":9320245.75,
"x":-1388.8531,
"y":-2154.51215
},
"50%":{
"num_claims":15.0,
"id":9322341.5,
"x":-77.67177,
"y":558.54065
},
"75%":{
"num_claims":20.0,
"id":9324494.25,
"x":1270.54565,
"y":1802.24125
},
"max":{
"num_claims":100.0,
"id":9480195.0,
"x":4113.4414,
"y":3986.0618
}
}
'''
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 graphext cluster is the most common among the patents?
# 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 graphext cluster is the most common among the patents?
df.columns = ['num_claims', 'organization', 'kind', 'type', 'graphext_cluster', 'date', 'abstract', 'title', 'lang', 'abstract_gx_ADJ', 'grp_title', 'abstract_gx_products', 'abstract_gx_organizations', 'abstract_gx_NOUN', 'abstract_gx_ngrams', 'id', 'target', 'weight', 'x', 'y']
# Expected output type: is category, this will be checked.
return | 20250129013716 |
72 | Which are the top 3 organizations with the most patents? Use alphabetical order to break any ties. | 053_Patents | dev | list[category] | ['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": "num_claims",
"type": "uint8"
},
{
"name": "organization",
"type": "category"
},
{
"name": "kind",
"type": "category"
},
{
"name": "type",
"type": "category"
},
{
"name": "graphext_cluster",
"type": "category"
},
{
"name": "date",
"type": "datetime64[ns, UTC]"
},
{
"name": "abstract",
"type": "object"
},
{
"name": "title",
"type": "object"
},
{
"name": "lang",
"type": "category"
},
{
"name": "abstract_gx_ADJ",
"type": "object"
},
{
"name": "grp_title",
"type": "object"
},
{
"name": "abstract_gx_products",
"type": "object"
},
{
"name": "abstract_gx_organizations",
"type": "object"
},
{
"name": "abstract_gx_NOUN",
"type": "object"
},
{
"name": "abstract_gx_ngrams",
"type": "object"
},
{
"name": "id",
"type": "float64"
},
{
"name": "target",
"type": "object"
},
{
"name": "weight",
"type": "object"
},
{
"name": "x",
"type": "float64"
},
{
"name": "y",
"type": "float64"
}
]
}
# Description of dataframe columns.
df_descrption = {
"count":{
"num_claims":9999.0,
"id":8848.0,
"x":9999.0,
"y":9999.0
},
"mean":{
"num_claims":14.7459745975,
"id":9317464.8445976488,
"x":-21.058669389,
"y":-18.042839032
},
"std":{
"num_claims":9.4629164059,
"id":58501.3326715985,
"x":2061.5828151519,
"y":2228.8382538597
},
"min":{
"num_claims":1.0,
"id":9245593.0,
"x":-5218.812,
"y":-4434.756
},
"25%":{
"num_claims":8.0,
"id":9320245.75,
"x":-1388.8531,
"y":-2154.51215
},
"50%":{
"num_claims":15.0,
"id":9322341.5,
"x":-77.67177,
"y":558.54065
},
"75%":{
"num_claims":20.0,
"id":9324494.25,
"x":1270.54565,
"y":1802.24125
},
"max":{
"num_claims":100.0,
"id":9480195.0,
"x":4113.4414,
"y":3986.0618
}
}
# Randome sample of 10 rows from the dataframe.
df_random_sample = {
"count":{
"num_claims":9999.0,
"id":8848.0,
"x":9999.0,
"y":9999.0
},
"mean":{
"num_claims":14.7459745975,
"id":9317464.8445976488,
"x":-21.058669389,
"y":-18.042839032
},
"std":{
"num_claims":9.4629164059,
"id":58501.3326715985,
"x":2061.5828151519,
"y":2228.8382538597
},
"min":{
"num_claims":1.0,
"id":9245593.0,
"x":-5218.812,
"y":-4434.756
},
"25%":{
"num_claims":8.0,
"id":9320245.75,
"x":-1388.8531,
"y":-2154.51215
},
"50%":{
"num_claims":15.0,
"id":9322341.5,
"x":-77.67177,
"y":558.54065
},
"75%":{
"num_claims":20.0,
"id":9324494.25,
"x":1270.54565,
"y":1802.24125
},
"max":{
"num_claims":100.0,
"id":9480195.0,
"x":4113.4414,
"y":3986.0618
}
}
'''
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 top 3 organizations with the most patents? Use alphabetical order to break any ties.
# 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 top 3 organizations with the most patents? Use alphabetical order to break any ties.
df.columns = ['num_claims', 'organization', 'kind', 'type', 'graphext_cluster', 'date', 'abstract', 'title', 'lang', 'abstract_gx_ADJ', 'grp_title', 'abstract_gx_products', 'abstract_gx_organizations', 'abstract_gx_NOUN', 'abstract_gx_ngrams', 'id', 'target', 'weight', 'x', 'y']
# Expected output type: is list[category], this will be checked.
return | 20250129013716 |
73 | List the 2 most common types of patents in the dataset. | 053_Patents | dev | list[category] | ['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": "num_claims",
"type": "uint8"
},
{
"name": "organization",
"type": "category"
},
{
"name": "kind",
"type": "category"
},
{
"name": "type",
"type": "category"
},
{
"name": "graphext_cluster",
"type": "category"
},
{
"name": "date",
"type": "datetime64[ns, UTC]"
},
{
"name": "abstract",
"type": "object"
},
{
"name": "title",
"type": "object"
},
{
"name": "lang",
"type": "category"
},
{
"name": "abstract_gx_ADJ",
"type": "object"
},
{
"name": "grp_title",
"type": "object"
},
{
"name": "abstract_gx_products",
"type": "object"
},
{
"name": "abstract_gx_organizations",
"type": "object"
},
{
"name": "abstract_gx_NOUN",
"type": "object"
},
{
"name": "abstract_gx_ngrams",
"type": "object"
},
{
"name": "id",
"type": "float64"
},
{
"name": "target",
"type": "object"
},
{
"name": "weight",
"type": "object"
},
{
"name": "x",
"type": "float64"
},
{
"name": "y",
"type": "float64"
}
]
}
# Description of dataframe columns.
df_descrption = {
"count":{
"num_claims":9999.0,
"id":8848.0,
"x":9999.0,
"y":9999.0
},
"mean":{
"num_claims":14.7459745975,
"id":9317464.8445976488,
"x":-21.058669389,
"y":-18.042839032
},
"std":{
"num_claims":9.4629164059,
"id":58501.3326715985,
"x":2061.5828151519,
"y":2228.8382538597
},
"min":{
"num_claims":1.0,
"id":9245593.0,
"x":-5218.812,
"y":-4434.756
},
"25%":{
"num_claims":8.0,
"id":9320245.75,
"x":-1388.8531,
"y":-2154.51215
},
"50%":{
"num_claims":15.0,
"id":9322341.5,
"x":-77.67177,
"y":558.54065
},
"75%":{
"num_claims":20.0,
"id":9324494.25,
"x":1270.54565,
"y":1802.24125
},
"max":{
"num_claims":100.0,
"id":9480195.0,
"x":4113.4414,
"y":3986.0618
}
}
# Randome sample of 10 rows from the dataframe.
df_random_sample = {
"count":{
"num_claims":9999.0,
"id":8848.0,
"x":9999.0,
"y":9999.0
},
"mean":{
"num_claims":14.7459745975,
"id":9317464.8445976488,
"x":-21.058669389,
"y":-18.042839032
},
"std":{
"num_claims":9.4629164059,
"id":58501.3326715985,
"x":2061.5828151519,
"y":2228.8382538597
},
"min":{
"num_claims":1.0,
"id":9245593.0,
"x":-5218.812,
"y":-4434.756
},
"25%":{
"num_claims":8.0,
"id":9320245.75,
"x":-1388.8531,
"y":-2154.51215
},
"50%":{
"num_claims":15.0,
"id":9322341.5,
"x":-77.67177,
"y":558.54065
},
"75%":{
"num_claims":20.0,
"id":9324494.25,
"x":1270.54565,
"y":1802.24125
},
"max":{
"num_claims":100.0,
"id":9480195.0,
"x":4113.4414,
"y":3986.0618
}
}
'''
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 2 most common types of patents 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: List the 2 most common types of patents in the dataset.
df.columns = ['num_claims', 'organization', 'kind', 'type', 'graphext_cluster', 'date', 'abstract', 'title', 'lang', 'abstract_gx_ADJ', 'grp_title', 'abstract_gx_products', 'abstract_gx_organizations', 'abstract_gx_NOUN', 'abstract_gx_ngrams', 'id', 'target', 'weight', 'x', 'y']
# Expected output type: is list[category], this will be checked.
return | 20250129013716 |
74 | Which 2 kinds of patents are the most prevalent? | 053_Patents | dev | list[category] | ['kind'] | 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": "num_claims",
"type": "uint8"
},
{
"name": "organization",
"type": "category"
},
{
"name": "kind",
"type": "category"
},
{
"name": "type",
"type": "category"
},
{
"name": "graphext_cluster",
"type": "category"
},
{
"name": "date",
"type": "datetime64[ns, UTC]"
},
{
"name": "abstract",
"type": "object"
},
{
"name": "title",
"type": "object"
},
{
"name": "lang",
"type": "category"
},
{
"name": "abstract_gx_ADJ",
"type": "object"
},
{
"name": "grp_title",
"type": "object"
},
{
"name": "abstract_gx_products",
"type": "object"
},
{
"name": "abstract_gx_organizations",
"type": "object"
},
{
"name": "abstract_gx_NOUN",
"type": "object"
},
{
"name": "abstract_gx_ngrams",
"type": "object"
},
{
"name": "id",
"type": "float64"
},
{
"name": "target",
"type": "object"
},
{
"name": "weight",
"type": "object"
},
{
"name": "x",
"type": "float64"
},
{
"name": "y",
"type": "float64"
}
]
}
# Description of dataframe columns.
df_descrption = {
"count":{
"num_claims":9999.0,
"id":8848.0,
"x":9999.0,
"y":9999.0
},
"mean":{
"num_claims":14.7459745975,
"id":9317464.8445976488,
"x":-21.058669389,
"y":-18.042839032
},
"std":{
"num_claims":9.4629164059,
"id":58501.3326715985,
"x":2061.5828151519,
"y":2228.8382538597
},
"min":{
"num_claims":1.0,
"id":9245593.0,
"x":-5218.812,
"y":-4434.756
},
"25%":{
"num_claims":8.0,
"id":9320245.75,
"x":-1388.8531,
"y":-2154.51215
},
"50%":{
"num_claims":15.0,
"id":9322341.5,
"x":-77.67177,
"y":558.54065
},
"75%":{
"num_claims":20.0,
"id":9324494.25,
"x":1270.54565,
"y":1802.24125
},
"max":{
"num_claims":100.0,
"id":9480195.0,
"x":4113.4414,
"y":3986.0618
}
}
# Randome sample of 10 rows from the dataframe.
df_random_sample = {
"count":{
"num_claims":9999.0,
"id":8848.0,
"x":9999.0,
"y":9999.0
},
"mean":{
"num_claims":14.7459745975,
"id":9317464.8445976488,
"x":-21.058669389,
"y":-18.042839032
},
"std":{
"num_claims":9.4629164059,
"id":58501.3326715985,
"x":2061.5828151519,
"y":2228.8382538597
},
"min":{
"num_claims":1.0,
"id":9245593.0,
"x":-5218.812,
"y":-4434.756
},
"25%":{
"num_claims":8.0,
"id":9320245.75,
"x":-1388.8531,
"y":-2154.51215
},
"50%":{
"num_claims":15.0,
"id":9322341.5,
"x":-77.67177,
"y":558.54065
},
"75%":{
"num_claims":20.0,
"id":9324494.25,
"x":1270.54565,
"y":1802.24125
},
"max":{
"num_claims":100.0,
"id":9480195.0,
"x":4113.4414,
"y":3986.0618
}
}
'''
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 2 kinds of patents are the most prevalent?
# 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 2 kinds of patents are the most prevalent?
df.columns = ['num_claims', 'organization', 'kind', 'type', 'graphext_cluster', 'date', 'abstract', 'title', 'lang', 'abstract_gx_ADJ', 'grp_title', 'abstract_gx_products', 'abstract_gx_organizations', 'abstract_gx_NOUN', 'abstract_gx_ngrams', 'id', 'target', 'weight', 'x', 'y']
# Expected output type: is list[category], this will be checked.
return | 20250129013716 |
75 | List the 2 least common graphext clusters among the patents. If there is a tie go by reverse alphabetical order | 053_Patents | dev | list[category] | ['graphext_cluster'] | 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": "num_claims",
"type": "uint8"
},
{
"name": "organization",
"type": "category"
},
{
"name": "kind",
"type": "category"
},
{
"name": "type",
"type": "category"
},
{
"name": "graphext_cluster",
"type": "category"
},
{
"name": "date",
"type": "datetime64[ns, UTC]"
},
{
"name": "abstract",
"type": "object"
},
{
"name": "title",
"type": "object"
},
{
"name": "lang",
"type": "category"
},
{
"name": "abstract_gx_ADJ",
"type": "object"
},
{
"name": "grp_title",
"type": "object"
},
{
"name": "abstract_gx_products",
"type": "object"
},
{
"name": "abstract_gx_organizations",
"type": "object"
},
{
"name": "abstract_gx_NOUN",
"type": "object"
},
{
"name": "abstract_gx_ngrams",
"type": "object"
},
{
"name": "id",
"type": "float64"
},
{
"name": "target",
"type": "object"
},
{
"name": "weight",
"type": "object"
},
{
"name": "x",
"type": "float64"
},
{
"name": "y",
"type": "float64"
}
]
}
# Description of dataframe columns.
df_descrption = {
"count":{
"num_claims":9999.0,
"id":8848.0,
"x":9999.0,
"y":9999.0
},
"mean":{
"num_claims":14.7459745975,
"id":9317464.8445976488,
"x":-21.058669389,
"y":-18.042839032
},
"std":{
"num_claims":9.4629164059,
"id":58501.3326715985,
"x":2061.5828151519,
"y":2228.8382538597
},
"min":{
"num_claims":1.0,
"id":9245593.0,
"x":-5218.812,
"y":-4434.756
},
"25%":{
"num_claims":8.0,
"id":9320245.75,
"x":-1388.8531,
"y":-2154.51215
},
"50%":{
"num_claims":15.0,
"id":9322341.5,
"x":-77.67177,
"y":558.54065
},
"75%":{
"num_claims":20.0,
"id":9324494.25,
"x":1270.54565,
"y":1802.24125
},
"max":{
"num_claims":100.0,
"id":9480195.0,
"x":4113.4414,
"y":3986.0618
}
}
# Randome sample of 10 rows from the dataframe.
df_random_sample = {
"count":{
"num_claims":9999.0,
"id":8848.0,
"x":9999.0,
"y":9999.0
},
"mean":{
"num_claims":14.7459745975,
"id":9317464.8445976488,
"x":-21.058669389,
"y":-18.042839032
},
"std":{
"num_claims":9.4629164059,
"id":58501.3326715985,
"x":2061.5828151519,
"y":2228.8382538597
},
"min":{
"num_claims":1.0,
"id":9245593.0,
"x":-5218.812,
"y":-4434.756
},
"25%":{
"num_claims":8.0,
"id":9320245.75,
"x":-1388.8531,
"y":-2154.51215
},
"50%":{
"num_claims":15.0,
"id":9322341.5,
"x":-77.67177,
"y":558.54065
},
"75%":{
"num_claims":20.0,
"id":9324494.25,
"x":1270.54565,
"y":1802.24125
},
"max":{
"num_claims":100.0,
"id":9480195.0,
"x":4113.4414,
"y":3986.0618
}
}
'''
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 2 least common graphext clusters among the patents. If there is a tie go by reverse 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: List the 2 least common graphext clusters among the patents. If there is a tie go by reverse alphabetical order
df.columns = ['num_claims', 'organization', 'kind', 'type', 'graphext_cluster', 'date', 'abstract', 'title', 'lang', 'abstract_gx_ADJ', 'grp_title', 'abstract_gx_products', 'abstract_gx_organizations', 'abstract_gx_NOUN', 'abstract_gx_ngrams', 'id', 'target', 'weight', 'x', 'y']
# Expected output type: is list[category], this will be checked.
return | 20250129013716 |
76 | What are the top 4 numbers of claims in the patents? | 053_Patents | dev | list[number] | ['num_claims'] | 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": "num_claims",
"type": "uint8"
},
{
"name": "organization",
"type": "category"
},
{
"name": "kind",
"type": "category"
},
{
"name": "type",
"type": "category"
},
{
"name": "graphext_cluster",
"type": "category"
},
{
"name": "date",
"type": "datetime64[ns, UTC]"
},
{
"name": "abstract",
"type": "object"
},
{
"name": "title",
"type": "object"
},
{
"name": "lang",
"type": "category"
},
{
"name": "abstract_gx_ADJ",
"type": "object"
},
{
"name": "grp_title",
"type": "object"
},
{
"name": "abstract_gx_products",
"type": "object"
},
{
"name": "abstract_gx_organizations",
"type": "object"
},
{
"name": "abstract_gx_NOUN",
"type": "object"
},
{
"name": "abstract_gx_ngrams",
"type": "object"
},
{
"name": "id",
"type": "float64"
},
{
"name": "target",
"type": "object"
},
{
"name": "weight",
"type": "object"
},
{
"name": "x",
"type": "float64"
},
{
"name": "y",
"type": "float64"
}
]
}
# Description of dataframe columns.
df_descrption = {
"count":{
"num_claims":9999.0,
"id":8848.0,
"x":9999.0,
"y":9999.0
},
"mean":{
"num_claims":14.7459745975,
"id":9317464.8445976488,
"x":-21.058669389,
"y":-18.042839032
},
"std":{
"num_claims":9.4629164059,
"id":58501.3326715985,
"x":2061.5828151519,
"y":2228.8382538597
},
"min":{
"num_claims":1.0,
"id":9245593.0,
"x":-5218.812,
"y":-4434.756
},
"25%":{
"num_claims":8.0,
"id":9320245.75,
"x":-1388.8531,
"y":-2154.51215
},
"50%":{
"num_claims":15.0,
"id":9322341.5,
"x":-77.67177,
"y":558.54065
},
"75%":{
"num_claims":20.0,
"id":9324494.25,
"x":1270.54565,
"y":1802.24125
},
"max":{
"num_claims":100.0,
"id":9480195.0,
"x":4113.4414,
"y":3986.0618
}
}
# Randome sample of 10 rows from the dataframe.
df_random_sample = {
"count":{
"num_claims":9999.0,
"id":8848.0,
"x":9999.0,
"y":9999.0
},
"mean":{
"num_claims":14.7459745975,
"id":9317464.8445976488,
"x":-21.058669389,
"y":-18.042839032
},
"std":{
"num_claims":9.4629164059,
"id":58501.3326715985,
"x":2061.5828151519,
"y":2228.8382538597
},
"min":{
"num_claims":1.0,
"id":9245593.0,
"x":-5218.812,
"y":-4434.756
},
"25%":{
"num_claims":8.0,
"id":9320245.75,
"x":-1388.8531,
"y":-2154.51215
},
"50%":{
"num_claims":15.0,
"id":9322341.5,
"x":-77.67177,
"y":558.54065
},
"75%":{
"num_claims":20.0,
"id":9324494.25,
"x":1270.54565,
"y":1802.24125
},
"max":{
"num_claims":100.0,
"id":9480195.0,
"x":4113.4414,
"y":3986.0618
}
}
'''
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 numbers of claims in the patents?
# 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 numbers of claims in the patents?
df.columns = ['num_claims', 'organization', 'kind', 'type', 'graphext_cluster', 'date', 'abstract', 'title', 'lang', 'abstract_gx_ADJ', 'grp_title', 'abstract_gx_products', 'abstract_gx_organizations', 'abstract_gx_NOUN', 'abstract_gx_ngrams', 'id', 'target', 'weight', 'x', 'y']
# Expected output type: is list[number], this will be checked.
return | 20250129013716 |
77 | List the 3 patents (by ID) with the most number of claims. | 053_Patents | dev | list[number] | ['id', 'num_claims'] | 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": "num_claims",
"type": "uint8"
},
{
"name": "organization",
"type": "category"
},
{
"name": "kind",
"type": "category"
},
{
"name": "type",
"type": "category"
},
{
"name": "graphext_cluster",
"type": "category"
},
{
"name": "date",
"type": "datetime64[ns, UTC]"
},
{
"name": "abstract",
"type": "object"
},
{
"name": "title",
"type": "object"
},
{
"name": "lang",
"type": "category"
},
{
"name": "abstract_gx_ADJ",
"type": "object"
},
{
"name": "grp_title",
"type": "object"
},
{
"name": "abstract_gx_products",
"type": "object"
},
{
"name": "abstract_gx_organizations",
"type": "object"
},
{
"name": "abstract_gx_NOUN",
"type": "object"
},
{
"name": "abstract_gx_ngrams",
"type": "object"
},
{
"name": "id",
"type": "float64"
},
{
"name": "target",
"type": "object"
},
{
"name": "weight",
"type": "object"
},
{
"name": "x",
"type": "float64"
},
{
"name": "y",
"type": "float64"
}
]
}
# Description of dataframe columns.
df_descrption = {
"count":{
"num_claims":9999.0,
"id":8848.0,
"x":9999.0,
"y":9999.0
},
"mean":{
"num_claims":14.7459745975,
"id":9317464.8445976488,
"x":-21.058669389,
"y":-18.042839032
},
"std":{
"num_claims":9.4629164059,
"id":58501.3326715985,
"x":2061.5828151519,
"y":2228.8382538597
},
"min":{
"num_claims":1.0,
"id":9245593.0,
"x":-5218.812,
"y":-4434.756
},
"25%":{
"num_claims":8.0,
"id":9320245.75,
"x":-1388.8531,
"y":-2154.51215
},
"50%":{
"num_claims":15.0,
"id":9322341.5,
"x":-77.67177,
"y":558.54065
},
"75%":{
"num_claims":20.0,
"id":9324494.25,
"x":1270.54565,
"y":1802.24125
},
"max":{
"num_claims":100.0,
"id":9480195.0,
"x":4113.4414,
"y":3986.0618
}
}
# Randome sample of 10 rows from the dataframe.
df_random_sample = {
"count":{
"num_claims":9999.0,
"id":8848.0,
"x":9999.0,
"y":9999.0
},
"mean":{
"num_claims":14.7459745975,
"id":9317464.8445976488,
"x":-21.058669389,
"y":-18.042839032
},
"std":{
"num_claims":9.4629164059,
"id":58501.3326715985,
"x":2061.5828151519,
"y":2228.8382538597
},
"min":{
"num_claims":1.0,
"id":9245593.0,
"x":-5218.812,
"y":-4434.756
},
"25%":{
"num_claims":8.0,
"id":9320245.75,
"x":-1388.8531,
"y":-2154.51215
},
"50%":{
"num_claims":15.0,
"id":9322341.5,
"x":-77.67177,
"y":558.54065
},
"75%":{
"num_claims":20.0,
"id":9324494.25,
"x":1270.54565,
"y":1802.24125
},
"max":{
"num_claims":100.0,
"id":9480195.0,
"x":4113.4414,
"y":3986.0618
}
}
'''
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 3 patents (by ID) with the most number of claims.
# 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 3 patents (by ID) with the most number of claims.
df.columns = ['num_claims', 'organization', 'kind', 'type', 'graphext_cluster', 'date', 'abstract', 'title', 'lang', 'abstract_gx_ADJ', 'grp_title', 'abstract_gx_products', 'abstract_gx_organizations', 'abstract_gx_NOUN', 'abstract_gx_ngrams', 'id', 'target', 'weight', 'x', 'y']
# Expected output type: is list[number], this will be checked.
return | 20250129013716 |
78 | Provide a list with the median number of claims for the B2 and S1 kinds separately. | 053_Patents | dev | list[number] | ['num_claim', 'kind'] | 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": "num_claims",
"type": "uint8"
},
{
"name": "organization",
"type": "category"
},
{
"name": "kind",
"type": "category"
},
{
"name": "type",
"type": "category"
},
{
"name": "graphext_cluster",
"type": "category"
},
{
"name": "date",
"type": "datetime64[ns, UTC]"
},
{
"name": "abstract",
"type": "object"
},
{
"name": "title",
"type": "object"
},
{
"name": "lang",
"type": "category"
},
{
"name": "abstract_gx_ADJ",
"type": "object"
},
{
"name": "grp_title",
"type": "object"
},
{
"name": "abstract_gx_products",
"type": "object"
},
{
"name": "abstract_gx_organizations",
"type": "object"
},
{
"name": "abstract_gx_NOUN",
"type": "object"
},
{
"name": "abstract_gx_ngrams",
"type": "object"
},
{
"name": "id",
"type": "float64"
},
{
"name": "target",
"type": "object"
},
{
"name": "weight",
"type": "object"
},
{
"name": "x",
"type": "float64"
},
{
"name": "y",
"type": "float64"
}
]
}
# Description of dataframe columns.
df_descrption = {
"count":{
"num_claims":9999.0,
"id":8848.0,
"x":9999.0,
"y":9999.0
},
"mean":{
"num_claims":14.7459745975,
"id":9317464.8445976488,
"x":-21.058669389,
"y":-18.042839032
},
"std":{
"num_claims":9.4629164059,
"id":58501.3326715985,
"x":2061.5828151519,
"y":2228.8382538597
},
"min":{
"num_claims":1.0,
"id":9245593.0,
"x":-5218.812,
"y":-4434.756
},
"25%":{
"num_claims":8.0,
"id":9320245.75,
"x":-1388.8531,
"y":-2154.51215
},
"50%":{
"num_claims":15.0,
"id":9322341.5,
"x":-77.67177,
"y":558.54065
},
"75%":{
"num_claims":20.0,
"id":9324494.25,
"x":1270.54565,
"y":1802.24125
},
"max":{
"num_claims":100.0,
"id":9480195.0,
"x":4113.4414,
"y":3986.0618
}
}
# Randome sample of 10 rows from the dataframe.
df_random_sample = {
"count":{
"num_claims":9999.0,
"id":8848.0,
"x":9999.0,
"y":9999.0
},
"mean":{
"num_claims":14.7459745975,
"id":9317464.8445976488,
"x":-21.058669389,
"y":-18.042839032
},
"std":{
"num_claims":9.4629164059,
"id":58501.3326715985,
"x":2061.5828151519,
"y":2228.8382538597
},
"min":{
"num_claims":1.0,
"id":9245593.0,
"x":-5218.812,
"y":-4434.756
},
"25%":{
"num_claims":8.0,
"id":9320245.75,
"x":-1388.8531,
"y":-2154.51215
},
"50%":{
"num_claims":15.0,
"id":9322341.5,
"x":-77.67177,
"y":558.54065
},
"75%":{
"num_claims":20.0,
"id":9324494.25,
"x":1270.54565,
"y":1802.24125
},
"max":{
"num_claims":100.0,
"id":9480195.0,
"x":4113.4414,
"y":3986.0618
}
}
'''
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: Provide a list with the median number of claims for the B2 and S1 kinds separately.
# The answer should only contain python code, you are not allowed leave any TODO undone.
def answer(df: pd.DataFrame):
# Use df to answer: Provide a list with the median number of claims for the B2 and S1 kinds separately.
df.columns = ['num_claims', 'organization', 'kind', 'type', 'graphext_cluster', 'date', 'abstract', 'title', 'lang', 'abstract_gx_ADJ', 'grp_title', 'abstract_gx_products', 'abstract_gx_organizations', 'abstract_gx_NOUN', 'abstract_gx_ngrams', 'id', 'target', 'weight', 'x', 'y']
# Expected output type: is list[number], this will be checked.
return | 20250129013716 |
79 | List the 3 most recent patents by their ID. | 053_Patents | dev | list[number] | ['id', '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": "num_claims",
"type": "uint8"
},
{
"name": "organization",
"type": "category"
},
{
"name": "kind",
"type": "category"
},
{
"name": "type",
"type": "category"
},
{
"name": "graphext_cluster",
"type": "category"
},
{
"name": "date",
"type": "datetime64[ns, UTC]"
},
{
"name": "abstract",
"type": "object"
},
{
"name": "title",
"type": "object"
},
{
"name": "lang",
"type": "category"
},
{
"name": "abstract_gx_ADJ",
"type": "object"
},
{
"name": "grp_title",
"type": "object"
},
{
"name": "abstract_gx_products",
"type": "object"
},
{
"name": "abstract_gx_organizations",
"type": "object"
},
{
"name": "abstract_gx_NOUN",
"type": "object"
},
{
"name": "abstract_gx_ngrams",
"type": "object"
},
{
"name": "id",
"type": "float64"
},
{
"name": "target",
"type": "object"
},
{
"name": "weight",
"type": "object"
},
{
"name": "x",
"type": "float64"
},
{
"name": "y",
"type": "float64"
}
]
}
# Description of dataframe columns.
df_descrption = {
"count":{
"num_claims":9999.0,
"id":8848.0,
"x":9999.0,
"y":9999.0
},
"mean":{
"num_claims":14.7459745975,
"id":9317464.8445976488,
"x":-21.058669389,
"y":-18.042839032
},
"std":{
"num_claims":9.4629164059,
"id":58501.3326715985,
"x":2061.5828151519,
"y":2228.8382538597
},
"min":{
"num_claims":1.0,
"id":9245593.0,
"x":-5218.812,
"y":-4434.756
},
"25%":{
"num_claims":8.0,
"id":9320245.75,
"x":-1388.8531,
"y":-2154.51215
},
"50%":{
"num_claims":15.0,
"id":9322341.5,
"x":-77.67177,
"y":558.54065
},
"75%":{
"num_claims":20.0,
"id":9324494.25,
"x":1270.54565,
"y":1802.24125
},
"max":{
"num_claims":100.0,
"id":9480195.0,
"x":4113.4414,
"y":3986.0618
}
}
# Randome sample of 10 rows from the dataframe.
df_random_sample = {
"count":{
"num_claims":9999.0,
"id":8848.0,
"x":9999.0,
"y":9999.0
},
"mean":{
"num_claims":14.7459745975,
"id":9317464.8445976488,
"x":-21.058669389,
"y":-18.042839032
},
"std":{
"num_claims":9.4629164059,
"id":58501.3326715985,
"x":2061.5828151519,
"y":2228.8382538597
},
"min":{
"num_claims":1.0,
"id":9245593.0,
"x":-5218.812,
"y":-4434.756
},
"25%":{
"num_claims":8.0,
"id":9320245.75,
"x":-1388.8531,
"y":-2154.51215
},
"50%":{
"num_claims":15.0,
"id":9322341.5,
"x":-77.67177,
"y":558.54065
},
"75%":{
"num_claims":20.0,
"id":9324494.25,
"x":1270.54565,
"y":1802.24125
},
"max":{
"num_claims":100.0,
"id":9480195.0,
"x":4113.4414,
"y":3986.0618
}
}
'''
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 3 most recent patents by their 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: List the 3 most recent patents by their ID.
df.columns = ['num_claims', 'organization', 'kind', 'type', 'graphext_cluster', 'date', 'abstract', 'title', 'lang', 'abstract_gx_ADJ', 'grp_title', 'abstract_gx_products', 'abstract_gx_organizations', 'abstract_gx_NOUN', 'abstract_gx_ngrams', 'id', 'target', 'weight', 'x', 'y']
# Expected output type: is list[number], this will be checked.
return | 20250129013716 |
80 | Has the author with the highest number of followers ever been verified? | 054_Joe | dev | boolean | ['author_id<gx:category>', 'user_followers_count<gx:number>', 'user_verified<gx:boolean>'] | 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<gx:category>",
"type": "int64"
},
{
"name": "author_id<gx:category>",
"type": "uint32"
},
{
"name": "author_name<gx:category>",
"type": "category"
},
{
"name": "author_handler<gx:category>",
"type": "category"
},
{
"name": "author_avatar<gx:url>",
"type": "category"
},
{
"name": "user_created_at<gx:date>",
"type": "datetime64[ns, UTC]"
},
{
"name": "user_description<gx:text>",
"type": "category"
},
{
"name": "user_favourites_count<gx:number>",
"type": "uint8"
},
{
"name": "user_followers_count<gx:number>",
"type": "uint32"
},
{
"name": "user_following_count<gx:number>",
"type": "uint8"
},
{
"name": "user_listed_count<gx:number>",
"type": "uint16"
},
{
"name": "user_tweets_count<gx:number>",
"type": "uint16"
},
{
"name": "user_verified<gx:boolean>",
"type": "bool"
},
{
"name": "user_location<gx:text>",
"type": "category"
},
{
"name": "lang<gx:category>",
"type": "category"
},
{
"name": "type<gx:category>",
"type": "category"
},
{
"name": "text<gx:text>",
"type": "object"
},
{
"name": "date<gx:date>",
"type": "datetime64[ns, UTC]"
},
{
"name": "mention_ids<gx:list[category]>",
"type": "object"
},
{
"name": "mention_names<gx:list[category]>",
"type": "object"
},
{
"name": "retweets<gx:number>",
"type": "uint32"
},
{
"name": "favorites<gx:number>",
"type": "uint32"
},
{
"name": "replies<gx:number>",
"type": "uint16"
},
{
"name": "quotes<gx:number>",
"type": "uint16"
},
{
"name": "links<gx:list[url]>",
"type": "object"
},
{
"name": "links_first<gx:url>",
"type": "category"
},
{
"name": "image_links<gx:list[url]>",
"type": "object"
},
{
"name": "image_links_first<gx:url>",
"type": "category"
},
{
"name": "rp_user_id<gx:category>",
"type": "category"
},
{
"name": "rp_user_name<gx:category>",
"type": "category"
},
{
"name": "location<gx:text>",
"type": "category"
},
{
"name": "tweet_link<gx:url>",
"type": "category"
},
{
"name": "source<gx:text>",
"type": "category"
},
{
"name": "search<gx:category>",
"type": "category"
}
]
}
# Description of dataframe columns.
df_descrption = {
"count":{
"id<gx:category>":491.0,
"author_id<gx:category>":491.0,
"user_favourites_count<gx:number>":491.0,
"user_followers_count<gx:number>":491.0,
"user_following_count<gx:number>":491.0,
"user_listed_count<gx:number>":491.0,
"user_tweets_count<gx:number>":491.0,
"retweets<gx:number>":491.0,
"favorites<gx:number>":491.0,
"replies<gx:number>":491.0,
"quotes<gx:number>":491.0
},
"mean":{
"id<gx:category>":1.230895609e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30218726.7454175167,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0590631365,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":5200.4623217923,
"favorites<gx:number>":41536.8635437882,
"replies<gx:number>":2056.5600814664,
"quotes<gx:number>":754.8859470468
},
"std":{
"id<gx:category>":7.194010391e+16,
"author_id<gx:category>":0.0,
"user_favourites_count<gx:number>":0.0,
"user_followers_count<gx:number>":23210.2101437425,
"user_following_count<gx:number>":0.0,
"user_listed_count<gx:number>":0.2526882771,
"user_tweets_count<gx:number>":0.0,
"retweets<gx:number>":13471.3749539952,
"favorites<gx:number>":99344.577018021,
"replies<gx:number>":3666.4962808525,
"quotes<gx:number>":3078.002195837
},
"min":{
"id<gx:category>":1.100456021e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212691.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36166.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":85.0,
"favorites<gx:number>":393.0,
"replies<gx:number>":22.0,
"quotes<gx:number>":0.0
},
"25%":{
"id<gx:category>":1.16465648e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212703.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":249.0,
"favorites<gx:number>":1245.5,
"replies<gx:number>":156.0,
"quotes<gx:number>":22.0
},
"50%":{
"id<gx:category>":1.229553614e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212708.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":1218.0,
"favorites<gx:number>":5730.0,
"replies<gx:number>":552.0,
"quotes<gx:number>":90.0
},
"75%":{
"id<gx:category>":1.296563283e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212712.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":4589.5,
"favorites<gx:number>":28466.5,
"replies<gx:number>":2210.0,
"quotes<gx:number>":444.0
},
"max":{
"id<gx:category>":1.391422726e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30308047.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36168.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":205169.0,
"favorites<gx:number>":889245.0,
"replies<gx:number>":29351.0,
"quotes<gx:number>":57012.0
}
}
# Randome sample of 10 rows from the dataframe.
df_random_sample = {
"count":{
"id<gx:category>":491.0,
"author_id<gx:category>":491.0,
"user_favourites_count<gx:number>":491.0,
"user_followers_count<gx:number>":491.0,
"user_following_count<gx:number>":491.0,
"user_listed_count<gx:number>":491.0,
"user_tweets_count<gx:number>":491.0,
"retweets<gx:number>":491.0,
"favorites<gx:number>":491.0,
"replies<gx:number>":491.0,
"quotes<gx:number>":491.0
},
"mean":{
"id<gx:category>":1.230895609e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30218726.7454175167,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0590631365,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":5200.4623217923,
"favorites<gx:number>":41536.8635437882,
"replies<gx:number>":2056.5600814664,
"quotes<gx:number>":754.8859470468
},
"std":{
"id<gx:category>":7.194010391e+16,
"author_id<gx:category>":0.0,
"user_favourites_count<gx:number>":0.0,
"user_followers_count<gx:number>":23210.2101437425,
"user_following_count<gx:number>":0.0,
"user_listed_count<gx:number>":0.2526882771,
"user_tweets_count<gx:number>":0.0,
"retweets<gx:number>":13471.3749539952,
"favorites<gx:number>":99344.577018021,
"replies<gx:number>":3666.4962808525,
"quotes<gx:number>":3078.002195837
},
"min":{
"id<gx:category>":1.100456021e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212691.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36166.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":85.0,
"favorites<gx:number>":393.0,
"replies<gx:number>":22.0,
"quotes<gx:number>":0.0
},
"25%":{
"id<gx:category>":1.16465648e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212703.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":249.0,
"favorites<gx:number>":1245.5,
"replies<gx:number>":156.0,
"quotes<gx:number>":22.0
},
"50%":{
"id<gx:category>":1.229553614e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212708.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":1218.0,
"favorites<gx:number>":5730.0,
"replies<gx:number>":552.0,
"quotes<gx:number>":90.0
},
"75%":{
"id<gx:category>":1.296563283e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212712.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":4589.5,
"favorites<gx:number>":28466.5,
"replies<gx:number>":2210.0,
"quotes<gx:number>":444.0
},
"max":{
"id<gx:category>":1.391422726e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30308047.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36168.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":205169.0,
"favorites<gx:number>":889245.0,
"replies<gx:number>":29351.0,
"quotes<gx:number>":57012.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 with the highest number of followers ever been verified?
# 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 with the highest number of followers ever been verified?
df.columns = ['id<gx:category>', 'author_id<gx:category>', 'author_name<gx:category>', 'author_handler<gx:category>', 'author_avatar<gx:url>', 'user_created_at<gx:date>', 'user_description<gx:text>', 'user_favourites_count<gx:number>', 'user_followers_count<gx:number>', 'user_following_count<gx:number>', 'user_listed_count<gx:number>', 'user_tweets_count<gx:number>', 'user_verified<gx:boolean>', 'user_location<gx:text>', 'lang<gx:category>', 'type<gx:category>', 'text<gx:text>', 'date<gx:date>', 'mention_ids<gx:list[category]>', 'mention_names<gx:list[category]>', 'retweets<gx:number>', 'favorites<gx:number>', 'replies<gx:number>', 'quotes<gx:number>', 'links<gx:list[url]>', 'links_first<gx:url>', 'image_links<gx:list[url]>', 'image_links_first<gx:url>', 'rp_user_id<gx:category>', 'rp_user_name<gx:category>', 'location<gx:text>', 'tweet_link<gx:url>', 'source<gx:text>', 'search<gx:category>']
# Expected output type: is boolean, this will be checked.
return | 20250129013716 |
81 | Is the author who has the most favourites also the one with the most retweets? | 054_Joe | dev | boolean | ['author_id<gx:category>', 'user_favourites_count<gx:number>', 'retweets<gx:number>'] | 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<gx:category>",
"type": "int64"
},
{
"name": "author_id<gx:category>",
"type": "uint32"
},
{
"name": "author_name<gx:category>",
"type": "category"
},
{
"name": "author_handler<gx:category>",
"type": "category"
},
{
"name": "author_avatar<gx:url>",
"type": "category"
},
{
"name": "user_created_at<gx:date>",
"type": "datetime64[ns, UTC]"
},
{
"name": "user_description<gx:text>",
"type": "category"
},
{
"name": "user_favourites_count<gx:number>",
"type": "uint8"
},
{
"name": "user_followers_count<gx:number>",
"type": "uint32"
},
{
"name": "user_following_count<gx:number>",
"type": "uint8"
},
{
"name": "user_listed_count<gx:number>",
"type": "uint16"
},
{
"name": "user_tweets_count<gx:number>",
"type": "uint16"
},
{
"name": "user_verified<gx:boolean>",
"type": "bool"
},
{
"name": "user_location<gx:text>",
"type": "category"
},
{
"name": "lang<gx:category>",
"type": "category"
},
{
"name": "type<gx:category>",
"type": "category"
},
{
"name": "text<gx:text>",
"type": "object"
},
{
"name": "date<gx:date>",
"type": "datetime64[ns, UTC]"
},
{
"name": "mention_ids<gx:list[category]>",
"type": "object"
},
{
"name": "mention_names<gx:list[category]>",
"type": "object"
},
{
"name": "retweets<gx:number>",
"type": "uint32"
},
{
"name": "favorites<gx:number>",
"type": "uint32"
},
{
"name": "replies<gx:number>",
"type": "uint16"
},
{
"name": "quotes<gx:number>",
"type": "uint16"
},
{
"name": "links<gx:list[url]>",
"type": "object"
},
{
"name": "links_first<gx:url>",
"type": "category"
},
{
"name": "image_links<gx:list[url]>",
"type": "object"
},
{
"name": "image_links_first<gx:url>",
"type": "category"
},
{
"name": "rp_user_id<gx:category>",
"type": "category"
},
{
"name": "rp_user_name<gx:category>",
"type": "category"
},
{
"name": "location<gx:text>",
"type": "category"
},
{
"name": "tweet_link<gx:url>",
"type": "category"
},
{
"name": "source<gx:text>",
"type": "category"
},
{
"name": "search<gx:category>",
"type": "category"
}
]
}
# Description of dataframe columns.
df_descrption = {
"count":{
"id<gx:category>":491.0,
"author_id<gx:category>":491.0,
"user_favourites_count<gx:number>":491.0,
"user_followers_count<gx:number>":491.0,
"user_following_count<gx:number>":491.0,
"user_listed_count<gx:number>":491.0,
"user_tweets_count<gx:number>":491.0,
"retweets<gx:number>":491.0,
"favorites<gx:number>":491.0,
"replies<gx:number>":491.0,
"quotes<gx:number>":491.0
},
"mean":{
"id<gx:category>":1.230895609e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30218726.7454175167,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0590631365,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":5200.4623217923,
"favorites<gx:number>":41536.8635437882,
"replies<gx:number>":2056.5600814664,
"quotes<gx:number>":754.8859470468
},
"std":{
"id<gx:category>":7.194010391e+16,
"author_id<gx:category>":0.0,
"user_favourites_count<gx:number>":0.0,
"user_followers_count<gx:number>":23210.2101437425,
"user_following_count<gx:number>":0.0,
"user_listed_count<gx:number>":0.2526882771,
"user_tweets_count<gx:number>":0.0,
"retweets<gx:number>":13471.3749539952,
"favorites<gx:number>":99344.577018021,
"replies<gx:number>":3666.4962808525,
"quotes<gx:number>":3078.002195837
},
"min":{
"id<gx:category>":1.100456021e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212691.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36166.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":85.0,
"favorites<gx:number>":393.0,
"replies<gx:number>":22.0,
"quotes<gx:number>":0.0
},
"25%":{
"id<gx:category>":1.16465648e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212703.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":249.0,
"favorites<gx:number>":1245.5,
"replies<gx:number>":156.0,
"quotes<gx:number>":22.0
},
"50%":{
"id<gx:category>":1.229553614e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212708.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":1218.0,
"favorites<gx:number>":5730.0,
"replies<gx:number>":552.0,
"quotes<gx:number>":90.0
},
"75%":{
"id<gx:category>":1.296563283e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212712.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":4589.5,
"favorites<gx:number>":28466.5,
"replies<gx:number>":2210.0,
"quotes<gx:number>":444.0
},
"max":{
"id<gx:category>":1.391422726e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30308047.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36168.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":205169.0,
"favorites<gx:number>":889245.0,
"replies<gx:number>":29351.0,
"quotes<gx:number>":57012.0
}
}
# Randome sample of 10 rows from the dataframe.
df_random_sample = {
"count":{
"id<gx:category>":491.0,
"author_id<gx:category>":491.0,
"user_favourites_count<gx:number>":491.0,
"user_followers_count<gx:number>":491.0,
"user_following_count<gx:number>":491.0,
"user_listed_count<gx:number>":491.0,
"user_tweets_count<gx:number>":491.0,
"retweets<gx:number>":491.0,
"favorites<gx:number>":491.0,
"replies<gx:number>":491.0,
"quotes<gx:number>":491.0
},
"mean":{
"id<gx:category>":1.230895609e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30218726.7454175167,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0590631365,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":5200.4623217923,
"favorites<gx:number>":41536.8635437882,
"replies<gx:number>":2056.5600814664,
"quotes<gx:number>":754.8859470468
},
"std":{
"id<gx:category>":7.194010391e+16,
"author_id<gx:category>":0.0,
"user_favourites_count<gx:number>":0.0,
"user_followers_count<gx:number>":23210.2101437425,
"user_following_count<gx:number>":0.0,
"user_listed_count<gx:number>":0.2526882771,
"user_tweets_count<gx:number>":0.0,
"retweets<gx:number>":13471.3749539952,
"favorites<gx:number>":99344.577018021,
"replies<gx:number>":3666.4962808525,
"quotes<gx:number>":3078.002195837
},
"min":{
"id<gx:category>":1.100456021e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212691.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36166.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":85.0,
"favorites<gx:number>":393.0,
"replies<gx:number>":22.0,
"quotes<gx:number>":0.0
},
"25%":{
"id<gx:category>":1.16465648e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212703.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":249.0,
"favorites<gx:number>":1245.5,
"replies<gx:number>":156.0,
"quotes<gx:number>":22.0
},
"50%":{
"id<gx:category>":1.229553614e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212708.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":1218.0,
"favorites<gx:number>":5730.0,
"replies<gx:number>":552.0,
"quotes<gx:number>":90.0
},
"75%":{
"id<gx:category>":1.296563283e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212712.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":4589.5,
"favorites<gx:number>":28466.5,
"replies<gx:number>":2210.0,
"quotes<gx:number>":444.0
},
"max":{
"id<gx:category>":1.391422726e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30308047.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36168.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":205169.0,
"favorites<gx:number>":889245.0,
"replies<gx:number>":29351.0,
"quotes<gx:number>":57012.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 the author who has the most favourites also the one with the most 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: Is the author who has the most favourites also the one with the most retweets?
df.columns = ['id<gx:category>', 'author_id<gx:category>', 'author_name<gx:category>', 'author_handler<gx:category>', 'author_avatar<gx:url>', 'user_created_at<gx:date>', 'user_description<gx:text>', 'user_favourites_count<gx:number>', 'user_followers_count<gx:number>', 'user_following_count<gx:number>', 'user_listed_count<gx:number>', 'user_tweets_count<gx:number>', 'user_verified<gx:boolean>', 'user_location<gx:text>', 'lang<gx:category>', 'type<gx:category>', 'text<gx:text>', 'date<gx:date>', 'mention_ids<gx:list[category]>', 'mention_names<gx:list[category]>', 'retweets<gx:number>', 'favorites<gx:number>', 'replies<gx:number>', 'quotes<gx:number>', 'links<gx:list[url]>', 'links_first<gx:url>', 'image_links<gx:list[url]>', 'image_links_first<gx:url>', 'rp_user_id<gx:category>', 'rp_user_name<gx:category>', 'location<gx:text>', 'tweet_link<gx:url>', 'source<gx:text>', 'search<gx:category>']
# Expected output type: is boolean, this will be checked.
return | 20250129013716 |
82 | Is the most mentioned user also the most retweeted mentioned user? | 054_Joe | dev | boolean | ['author_id<gx:category>', 'mention_names<gx:list[category]>', 'retweets<gx:number>'] | 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<gx:category>",
"type": "int64"
},
{
"name": "author_id<gx:category>",
"type": "uint32"
},
{
"name": "author_name<gx:category>",
"type": "category"
},
{
"name": "author_handler<gx:category>",
"type": "category"
},
{
"name": "author_avatar<gx:url>",
"type": "category"
},
{
"name": "user_created_at<gx:date>",
"type": "datetime64[ns, UTC]"
},
{
"name": "user_description<gx:text>",
"type": "category"
},
{
"name": "user_favourites_count<gx:number>",
"type": "uint8"
},
{
"name": "user_followers_count<gx:number>",
"type": "uint32"
},
{
"name": "user_following_count<gx:number>",
"type": "uint8"
},
{
"name": "user_listed_count<gx:number>",
"type": "uint16"
},
{
"name": "user_tweets_count<gx:number>",
"type": "uint16"
},
{
"name": "user_verified<gx:boolean>",
"type": "bool"
},
{
"name": "user_location<gx:text>",
"type": "category"
},
{
"name": "lang<gx:category>",
"type": "category"
},
{
"name": "type<gx:category>",
"type": "category"
},
{
"name": "text<gx:text>",
"type": "object"
},
{
"name": "date<gx:date>",
"type": "datetime64[ns, UTC]"
},
{
"name": "mention_ids<gx:list[category]>",
"type": "object"
},
{
"name": "mention_names<gx:list[category]>",
"type": "object"
},
{
"name": "retweets<gx:number>",
"type": "uint32"
},
{
"name": "favorites<gx:number>",
"type": "uint32"
},
{
"name": "replies<gx:number>",
"type": "uint16"
},
{
"name": "quotes<gx:number>",
"type": "uint16"
},
{
"name": "links<gx:list[url]>",
"type": "object"
},
{
"name": "links_first<gx:url>",
"type": "category"
},
{
"name": "image_links<gx:list[url]>",
"type": "object"
},
{
"name": "image_links_first<gx:url>",
"type": "category"
},
{
"name": "rp_user_id<gx:category>",
"type": "category"
},
{
"name": "rp_user_name<gx:category>",
"type": "category"
},
{
"name": "location<gx:text>",
"type": "category"
},
{
"name": "tweet_link<gx:url>",
"type": "category"
},
{
"name": "source<gx:text>",
"type": "category"
},
{
"name": "search<gx:category>",
"type": "category"
}
]
}
# Description of dataframe columns.
df_descrption = {
"count":{
"id<gx:category>":491.0,
"author_id<gx:category>":491.0,
"user_favourites_count<gx:number>":491.0,
"user_followers_count<gx:number>":491.0,
"user_following_count<gx:number>":491.0,
"user_listed_count<gx:number>":491.0,
"user_tweets_count<gx:number>":491.0,
"retweets<gx:number>":491.0,
"favorites<gx:number>":491.0,
"replies<gx:number>":491.0,
"quotes<gx:number>":491.0
},
"mean":{
"id<gx:category>":1.230895609e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30218726.7454175167,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0590631365,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":5200.4623217923,
"favorites<gx:number>":41536.8635437882,
"replies<gx:number>":2056.5600814664,
"quotes<gx:number>":754.8859470468
},
"std":{
"id<gx:category>":7.194010391e+16,
"author_id<gx:category>":0.0,
"user_favourites_count<gx:number>":0.0,
"user_followers_count<gx:number>":23210.2101437425,
"user_following_count<gx:number>":0.0,
"user_listed_count<gx:number>":0.2526882771,
"user_tweets_count<gx:number>":0.0,
"retweets<gx:number>":13471.3749539952,
"favorites<gx:number>":99344.577018021,
"replies<gx:number>":3666.4962808525,
"quotes<gx:number>":3078.002195837
},
"min":{
"id<gx:category>":1.100456021e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212691.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36166.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":85.0,
"favorites<gx:number>":393.0,
"replies<gx:number>":22.0,
"quotes<gx:number>":0.0
},
"25%":{
"id<gx:category>":1.16465648e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212703.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":249.0,
"favorites<gx:number>":1245.5,
"replies<gx:number>":156.0,
"quotes<gx:number>":22.0
},
"50%":{
"id<gx:category>":1.229553614e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212708.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":1218.0,
"favorites<gx:number>":5730.0,
"replies<gx:number>":552.0,
"quotes<gx:number>":90.0
},
"75%":{
"id<gx:category>":1.296563283e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212712.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":4589.5,
"favorites<gx:number>":28466.5,
"replies<gx:number>":2210.0,
"quotes<gx:number>":444.0
},
"max":{
"id<gx:category>":1.391422726e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30308047.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36168.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":205169.0,
"favorites<gx:number>":889245.0,
"replies<gx:number>":29351.0,
"quotes<gx:number>":57012.0
}
}
# Randome sample of 10 rows from the dataframe.
df_random_sample = {
"count":{
"id<gx:category>":491.0,
"author_id<gx:category>":491.0,
"user_favourites_count<gx:number>":491.0,
"user_followers_count<gx:number>":491.0,
"user_following_count<gx:number>":491.0,
"user_listed_count<gx:number>":491.0,
"user_tweets_count<gx:number>":491.0,
"retweets<gx:number>":491.0,
"favorites<gx:number>":491.0,
"replies<gx:number>":491.0,
"quotes<gx:number>":491.0
},
"mean":{
"id<gx:category>":1.230895609e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30218726.7454175167,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0590631365,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":5200.4623217923,
"favorites<gx:number>":41536.8635437882,
"replies<gx:number>":2056.5600814664,
"quotes<gx:number>":754.8859470468
},
"std":{
"id<gx:category>":7.194010391e+16,
"author_id<gx:category>":0.0,
"user_favourites_count<gx:number>":0.0,
"user_followers_count<gx:number>":23210.2101437425,
"user_following_count<gx:number>":0.0,
"user_listed_count<gx:number>":0.2526882771,
"user_tweets_count<gx:number>":0.0,
"retweets<gx:number>":13471.3749539952,
"favorites<gx:number>":99344.577018021,
"replies<gx:number>":3666.4962808525,
"quotes<gx:number>":3078.002195837
},
"min":{
"id<gx:category>":1.100456021e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212691.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36166.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":85.0,
"favorites<gx:number>":393.0,
"replies<gx:number>":22.0,
"quotes<gx:number>":0.0
},
"25%":{
"id<gx:category>":1.16465648e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212703.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":249.0,
"favorites<gx:number>":1245.5,
"replies<gx:number>":156.0,
"quotes<gx:number>":22.0
},
"50%":{
"id<gx:category>":1.229553614e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212708.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":1218.0,
"favorites<gx:number>":5730.0,
"replies<gx:number>":552.0,
"quotes<gx:number>":90.0
},
"75%":{
"id<gx:category>":1.296563283e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212712.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":4589.5,
"favorites<gx:number>":28466.5,
"replies<gx:number>":2210.0,
"quotes<gx:number>":444.0
},
"max":{
"id<gx:category>":1.391422726e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30308047.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36168.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":205169.0,
"favorites<gx:number>":889245.0,
"replies<gx:number>":29351.0,
"quotes<gx:number>":57012.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 the most mentioned user also the most retweeted mentioned user?
# 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 the most mentioned user also the most retweeted mentioned user?
df.columns = ['id<gx:category>', 'author_id<gx:category>', 'author_name<gx:category>', 'author_handler<gx:category>', 'author_avatar<gx:url>', 'user_created_at<gx:date>', 'user_description<gx:text>', 'user_favourites_count<gx:number>', 'user_followers_count<gx:number>', 'user_following_count<gx:number>', 'user_listed_count<gx:number>', 'user_tweets_count<gx:number>', 'user_verified<gx:boolean>', 'user_location<gx:text>', 'lang<gx:category>', 'type<gx:category>', 'text<gx:text>', 'date<gx:date>', 'mention_ids<gx:list[category]>', 'mention_names<gx:list[category]>', 'retweets<gx:number>', 'favorites<gx:number>', 'replies<gx:number>', 'quotes<gx:number>', 'links<gx:list[url]>', 'links_first<gx:url>', 'image_links<gx:list[url]>', 'image_links_first<gx:url>', 'rp_user_id<gx:category>', 'rp_user_name<gx:category>', 'location<gx:text>', 'tweet_link<gx:url>', 'source<gx:text>', 'search<gx:category>']
# Expected output type: is boolean, this will be checked.
return | 20250129013716 |
83 | Does the author with the most retweets also have the most replies? | 054_Joe | dev | boolean | ['author_id<gx:category>', 'retweets<gx:number>', 'replies<gx:number>'] | 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<gx:category>",
"type": "int64"
},
{
"name": "author_id<gx:category>",
"type": "uint32"
},
{
"name": "author_name<gx:category>",
"type": "category"
},
{
"name": "author_handler<gx:category>",
"type": "category"
},
{
"name": "author_avatar<gx:url>",
"type": "category"
},
{
"name": "user_created_at<gx:date>",
"type": "datetime64[ns, UTC]"
},
{
"name": "user_description<gx:text>",
"type": "category"
},
{
"name": "user_favourites_count<gx:number>",
"type": "uint8"
},
{
"name": "user_followers_count<gx:number>",
"type": "uint32"
},
{
"name": "user_following_count<gx:number>",
"type": "uint8"
},
{
"name": "user_listed_count<gx:number>",
"type": "uint16"
},
{
"name": "user_tweets_count<gx:number>",
"type": "uint16"
},
{
"name": "user_verified<gx:boolean>",
"type": "bool"
},
{
"name": "user_location<gx:text>",
"type": "category"
},
{
"name": "lang<gx:category>",
"type": "category"
},
{
"name": "type<gx:category>",
"type": "category"
},
{
"name": "text<gx:text>",
"type": "object"
},
{
"name": "date<gx:date>",
"type": "datetime64[ns, UTC]"
},
{
"name": "mention_ids<gx:list[category]>",
"type": "object"
},
{
"name": "mention_names<gx:list[category]>",
"type": "object"
},
{
"name": "retweets<gx:number>",
"type": "uint32"
},
{
"name": "favorites<gx:number>",
"type": "uint32"
},
{
"name": "replies<gx:number>",
"type": "uint16"
},
{
"name": "quotes<gx:number>",
"type": "uint16"
},
{
"name": "links<gx:list[url]>",
"type": "object"
},
{
"name": "links_first<gx:url>",
"type": "category"
},
{
"name": "image_links<gx:list[url]>",
"type": "object"
},
{
"name": "image_links_first<gx:url>",
"type": "category"
},
{
"name": "rp_user_id<gx:category>",
"type": "category"
},
{
"name": "rp_user_name<gx:category>",
"type": "category"
},
{
"name": "location<gx:text>",
"type": "category"
},
{
"name": "tweet_link<gx:url>",
"type": "category"
},
{
"name": "source<gx:text>",
"type": "category"
},
{
"name": "search<gx:category>",
"type": "category"
}
]
}
# Description of dataframe columns.
df_descrption = {
"count":{
"id<gx:category>":491.0,
"author_id<gx:category>":491.0,
"user_favourites_count<gx:number>":491.0,
"user_followers_count<gx:number>":491.0,
"user_following_count<gx:number>":491.0,
"user_listed_count<gx:number>":491.0,
"user_tweets_count<gx:number>":491.0,
"retweets<gx:number>":491.0,
"favorites<gx:number>":491.0,
"replies<gx:number>":491.0,
"quotes<gx:number>":491.0
},
"mean":{
"id<gx:category>":1.230895609e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30218726.7454175167,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0590631365,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":5200.4623217923,
"favorites<gx:number>":41536.8635437882,
"replies<gx:number>":2056.5600814664,
"quotes<gx:number>":754.8859470468
},
"std":{
"id<gx:category>":7.194010391e+16,
"author_id<gx:category>":0.0,
"user_favourites_count<gx:number>":0.0,
"user_followers_count<gx:number>":23210.2101437425,
"user_following_count<gx:number>":0.0,
"user_listed_count<gx:number>":0.2526882771,
"user_tweets_count<gx:number>":0.0,
"retweets<gx:number>":13471.3749539952,
"favorites<gx:number>":99344.577018021,
"replies<gx:number>":3666.4962808525,
"quotes<gx:number>":3078.002195837
},
"min":{
"id<gx:category>":1.100456021e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212691.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36166.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":85.0,
"favorites<gx:number>":393.0,
"replies<gx:number>":22.0,
"quotes<gx:number>":0.0
},
"25%":{
"id<gx:category>":1.16465648e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212703.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":249.0,
"favorites<gx:number>":1245.5,
"replies<gx:number>":156.0,
"quotes<gx:number>":22.0
},
"50%":{
"id<gx:category>":1.229553614e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212708.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":1218.0,
"favorites<gx:number>":5730.0,
"replies<gx:number>":552.0,
"quotes<gx:number>":90.0
},
"75%":{
"id<gx:category>":1.296563283e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212712.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":4589.5,
"favorites<gx:number>":28466.5,
"replies<gx:number>":2210.0,
"quotes<gx:number>":444.0
},
"max":{
"id<gx:category>":1.391422726e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30308047.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36168.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":205169.0,
"favorites<gx:number>":889245.0,
"replies<gx:number>":29351.0,
"quotes<gx:number>":57012.0
}
}
# Randome sample of 10 rows from the dataframe.
df_random_sample = {
"count":{
"id<gx:category>":491.0,
"author_id<gx:category>":491.0,
"user_favourites_count<gx:number>":491.0,
"user_followers_count<gx:number>":491.0,
"user_following_count<gx:number>":491.0,
"user_listed_count<gx:number>":491.0,
"user_tweets_count<gx:number>":491.0,
"retweets<gx:number>":491.0,
"favorites<gx:number>":491.0,
"replies<gx:number>":491.0,
"quotes<gx:number>":491.0
},
"mean":{
"id<gx:category>":1.230895609e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30218726.7454175167,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0590631365,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":5200.4623217923,
"favorites<gx:number>":41536.8635437882,
"replies<gx:number>":2056.5600814664,
"quotes<gx:number>":754.8859470468
},
"std":{
"id<gx:category>":7.194010391e+16,
"author_id<gx:category>":0.0,
"user_favourites_count<gx:number>":0.0,
"user_followers_count<gx:number>":23210.2101437425,
"user_following_count<gx:number>":0.0,
"user_listed_count<gx:number>":0.2526882771,
"user_tweets_count<gx:number>":0.0,
"retweets<gx:number>":13471.3749539952,
"favorites<gx:number>":99344.577018021,
"replies<gx:number>":3666.4962808525,
"quotes<gx:number>":3078.002195837
},
"min":{
"id<gx:category>":1.100456021e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212691.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36166.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":85.0,
"favorites<gx:number>":393.0,
"replies<gx:number>":22.0,
"quotes<gx:number>":0.0
},
"25%":{
"id<gx:category>":1.16465648e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212703.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":249.0,
"favorites<gx:number>":1245.5,
"replies<gx:number>":156.0,
"quotes<gx:number>":22.0
},
"50%":{
"id<gx:category>":1.229553614e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212708.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":1218.0,
"favorites<gx:number>":5730.0,
"replies<gx:number>":552.0,
"quotes<gx:number>":90.0
},
"75%":{
"id<gx:category>":1.296563283e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212712.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":4589.5,
"favorites<gx:number>":28466.5,
"replies<gx:number>":2210.0,
"quotes<gx:number>":444.0
},
"max":{
"id<gx:category>":1.391422726e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30308047.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36168.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":205169.0,
"favorites<gx:number>":889245.0,
"replies<gx:number>":29351.0,
"quotes<gx:number>":57012.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 the author with the most retweets also have the most replies?
# 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 the author with the most retweets also have the most replies?
df.columns = ['id<gx:category>', 'author_id<gx:category>', 'author_name<gx:category>', 'author_handler<gx:category>', 'author_avatar<gx:url>', 'user_created_at<gx:date>', 'user_description<gx:text>', 'user_favourites_count<gx:number>', 'user_followers_count<gx:number>', 'user_following_count<gx:number>', 'user_listed_count<gx:number>', 'user_tweets_count<gx:number>', 'user_verified<gx:boolean>', 'user_location<gx:text>', 'lang<gx:category>', 'type<gx:category>', 'text<gx:text>', 'date<gx:date>', 'mention_ids<gx:list[category]>', 'mention_names<gx:list[category]>', 'retweets<gx:number>', 'favorites<gx:number>', 'replies<gx:number>', 'quotes<gx:number>', 'links<gx:list[url]>', 'links_first<gx:url>', 'image_links<gx:list[url]>', 'image_links_first<gx:url>', 'rp_user_id<gx:category>', 'rp_user_name<gx:category>', 'location<gx:text>', 'tweet_link<gx:url>', 'source<gx:text>', 'search<gx:category>']
# Expected output type: is boolean, this will be checked.
return | 20250129013716 |
84 | What is the maximum number of followers an author in the dataset has? | 054_Joe | dev | number | ['user_followers_count<gx:number>'] | 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<gx:category>",
"type": "int64"
},
{
"name": "author_id<gx:category>",
"type": "uint32"
},
{
"name": "author_name<gx:category>",
"type": "category"
},
{
"name": "author_handler<gx:category>",
"type": "category"
},
{
"name": "author_avatar<gx:url>",
"type": "category"
},
{
"name": "user_created_at<gx:date>",
"type": "datetime64[ns, UTC]"
},
{
"name": "user_description<gx:text>",
"type": "category"
},
{
"name": "user_favourites_count<gx:number>",
"type": "uint8"
},
{
"name": "user_followers_count<gx:number>",
"type": "uint32"
},
{
"name": "user_following_count<gx:number>",
"type": "uint8"
},
{
"name": "user_listed_count<gx:number>",
"type": "uint16"
},
{
"name": "user_tweets_count<gx:number>",
"type": "uint16"
},
{
"name": "user_verified<gx:boolean>",
"type": "bool"
},
{
"name": "user_location<gx:text>",
"type": "category"
},
{
"name": "lang<gx:category>",
"type": "category"
},
{
"name": "type<gx:category>",
"type": "category"
},
{
"name": "text<gx:text>",
"type": "object"
},
{
"name": "date<gx:date>",
"type": "datetime64[ns, UTC]"
},
{
"name": "mention_ids<gx:list[category]>",
"type": "object"
},
{
"name": "mention_names<gx:list[category]>",
"type": "object"
},
{
"name": "retweets<gx:number>",
"type": "uint32"
},
{
"name": "favorites<gx:number>",
"type": "uint32"
},
{
"name": "replies<gx:number>",
"type": "uint16"
},
{
"name": "quotes<gx:number>",
"type": "uint16"
},
{
"name": "links<gx:list[url]>",
"type": "object"
},
{
"name": "links_first<gx:url>",
"type": "category"
},
{
"name": "image_links<gx:list[url]>",
"type": "object"
},
{
"name": "image_links_first<gx:url>",
"type": "category"
},
{
"name": "rp_user_id<gx:category>",
"type": "category"
},
{
"name": "rp_user_name<gx:category>",
"type": "category"
},
{
"name": "location<gx:text>",
"type": "category"
},
{
"name": "tweet_link<gx:url>",
"type": "category"
},
{
"name": "source<gx:text>",
"type": "category"
},
{
"name": "search<gx:category>",
"type": "category"
}
]
}
# Description of dataframe columns.
df_descrption = {
"count":{
"id<gx:category>":491.0,
"author_id<gx:category>":491.0,
"user_favourites_count<gx:number>":491.0,
"user_followers_count<gx:number>":491.0,
"user_following_count<gx:number>":491.0,
"user_listed_count<gx:number>":491.0,
"user_tweets_count<gx:number>":491.0,
"retweets<gx:number>":491.0,
"favorites<gx:number>":491.0,
"replies<gx:number>":491.0,
"quotes<gx:number>":491.0
},
"mean":{
"id<gx:category>":1.230895609e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30218726.7454175167,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0590631365,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":5200.4623217923,
"favorites<gx:number>":41536.8635437882,
"replies<gx:number>":2056.5600814664,
"quotes<gx:number>":754.8859470468
},
"std":{
"id<gx:category>":7.194010391e+16,
"author_id<gx:category>":0.0,
"user_favourites_count<gx:number>":0.0,
"user_followers_count<gx:number>":23210.2101437425,
"user_following_count<gx:number>":0.0,
"user_listed_count<gx:number>":0.2526882771,
"user_tweets_count<gx:number>":0.0,
"retweets<gx:number>":13471.3749539952,
"favorites<gx:number>":99344.577018021,
"replies<gx:number>":3666.4962808525,
"quotes<gx:number>":3078.002195837
},
"min":{
"id<gx:category>":1.100456021e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212691.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36166.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":85.0,
"favorites<gx:number>":393.0,
"replies<gx:number>":22.0,
"quotes<gx:number>":0.0
},
"25%":{
"id<gx:category>":1.16465648e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212703.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":249.0,
"favorites<gx:number>":1245.5,
"replies<gx:number>":156.0,
"quotes<gx:number>":22.0
},
"50%":{
"id<gx:category>":1.229553614e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212708.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":1218.0,
"favorites<gx:number>":5730.0,
"replies<gx:number>":552.0,
"quotes<gx:number>":90.0
},
"75%":{
"id<gx:category>":1.296563283e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212712.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":4589.5,
"favorites<gx:number>":28466.5,
"replies<gx:number>":2210.0,
"quotes<gx:number>":444.0
},
"max":{
"id<gx:category>":1.391422726e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30308047.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36168.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":205169.0,
"favorites<gx:number>":889245.0,
"replies<gx:number>":29351.0,
"quotes<gx:number>":57012.0
}
}
# Randome sample of 10 rows from the dataframe.
df_random_sample = {
"count":{
"id<gx:category>":491.0,
"author_id<gx:category>":491.0,
"user_favourites_count<gx:number>":491.0,
"user_followers_count<gx:number>":491.0,
"user_following_count<gx:number>":491.0,
"user_listed_count<gx:number>":491.0,
"user_tweets_count<gx:number>":491.0,
"retweets<gx:number>":491.0,
"favorites<gx:number>":491.0,
"replies<gx:number>":491.0,
"quotes<gx:number>":491.0
},
"mean":{
"id<gx:category>":1.230895609e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30218726.7454175167,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0590631365,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":5200.4623217923,
"favorites<gx:number>":41536.8635437882,
"replies<gx:number>":2056.5600814664,
"quotes<gx:number>":754.8859470468
},
"std":{
"id<gx:category>":7.194010391e+16,
"author_id<gx:category>":0.0,
"user_favourites_count<gx:number>":0.0,
"user_followers_count<gx:number>":23210.2101437425,
"user_following_count<gx:number>":0.0,
"user_listed_count<gx:number>":0.2526882771,
"user_tweets_count<gx:number>":0.0,
"retweets<gx:number>":13471.3749539952,
"favorites<gx:number>":99344.577018021,
"replies<gx:number>":3666.4962808525,
"quotes<gx:number>":3078.002195837
},
"min":{
"id<gx:category>":1.100456021e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212691.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36166.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":85.0,
"favorites<gx:number>":393.0,
"replies<gx:number>":22.0,
"quotes<gx:number>":0.0
},
"25%":{
"id<gx:category>":1.16465648e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212703.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":249.0,
"favorites<gx:number>":1245.5,
"replies<gx:number>":156.0,
"quotes<gx:number>":22.0
},
"50%":{
"id<gx:category>":1.229553614e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212708.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":1218.0,
"favorites<gx:number>":5730.0,
"replies<gx:number>":552.0,
"quotes<gx:number>":90.0
},
"75%":{
"id<gx:category>":1.296563283e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212712.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":4589.5,
"favorites<gx:number>":28466.5,
"replies<gx:number>":2210.0,
"quotes<gx:number>":444.0
},
"max":{
"id<gx:category>":1.391422726e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30308047.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36168.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":205169.0,
"favorites<gx:number>":889245.0,
"replies<gx:number>":29351.0,
"quotes<gx:number>":57012.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 followers an author in the dataset 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 followers an author in the dataset has?
df.columns = ['id<gx:category>', 'author_id<gx:category>', 'author_name<gx:category>', 'author_handler<gx:category>', 'author_avatar<gx:url>', 'user_created_at<gx:date>', 'user_description<gx:text>', 'user_favourites_count<gx:number>', 'user_followers_count<gx:number>', 'user_following_count<gx:number>', 'user_listed_count<gx:number>', 'user_tweets_count<gx:number>', 'user_verified<gx:boolean>', 'user_location<gx:text>', 'lang<gx:category>', 'type<gx:category>', 'text<gx:text>', 'date<gx:date>', 'mention_ids<gx:list[category]>', 'mention_names<gx:list[category]>', 'retweets<gx:number>', 'favorites<gx:number>', 'replies<gx:number>', 'quotes<gx:number>', 'links<gx:list[url]>', 'links_first<gx:url>', 'image_links<gx:list[url]>', 'image_links_first<gx:url>', 'rp_user_id<gx:category>', 'rp_user_name<gx:category>', 'location<gx:text>', 'tweet_link<gx:url>', 'source<gx:text>', 'search<gx:category>']
# Expected output type: is number, this will be checked.
return | 20250129013716 |
85 | How many authors have tweets which have received more than 10,000 favourites? | 054_Joe | dev | number | ['favorites<gx:number>'] | 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<gx:category>",
"type": "int64"
},
{
"name": "author_id<gx:category>",
"type": "uint32"
},
{
"name": "author_name<gx:category>",
"type": "category"
},
{
"name": "author_handler<gx:category>",
"type": "category"
},
{
"name": "author_avatar<gx:url>",
"type": "category"
},
{
"name": "user_created_at<gx:date>",
"type": "datetime64[ns, UTC]"
},
{
"name": "user_description<gx:text>",
"type": "category"
},
{
"name": "user_favourites_count<gx:number>",
"type": "uint8"
},
{
"name": "user_followers_count<gx:number>",
"type": "uint32"
},
{
"name": "user_following_count<gx:number>",
"type": "uint8"
},
{
"name": "user_listed_count<gx:number>",
"type": "uint16"
},
{
"name": "user_tweets_count<gx:number>",
"type": "uint16"
},
{
"name": "user_verified<gx:boolean>",
"type": "bool"
},
{
"name": "user_location<gx:text>",
"type": "category"
},
{
"name": "lang<gx:category>",
"type": "category"
},
{
"name": "type<gx:category>",
"type": "category"
},
{
"name": "text<gx:text>",
"type": "object"
},
{
"name": "date<gx:date>",
"type": "datetime64[ns, UTC]"
},
{
"name": "mention_ids<gx:list[category]>",
"type": "object"
},
{
"name": "mention_names<gx:list[category]>",
"type": "object"
},
{
"name": "retweets<gx:number>",
"type": "uint32"
},
{
"name": "favorites<gx:number>",
"type": "uint32"
},
{
"name": "replies<gx:number>",
"type": "uint16"
},
{
"name": "quotes<gx:number>",
"type": "uint16"
},
{
"name": "links<gx:list[url]>",
"type": "object"
},
{
"name": "links_first<gx:url>",
"type": "category"
},
{
"name": "image_links<gx:list[url]>",
"type": "object"
},
{
"name": "image_links_first<gx:url>",
"type": "category"
},
{
"name": "rp_user_id<gx:category>",
"type": "category"
},
{
"name": "rp_user_name<gx:category>",
"type": "category"
},
{
"name": "location<gx:text>",
"type": "category"
},
{
"name": "tweet_link<gx:url>",
"type": "category"
},
{
"name": "source<gx:text>",
"type": "category"
},
{
"name": "search<gx:category>",
"type": "category"
}
]
}
# Description of dataframe columns.
df_descrption = {
"count":{
"id<gx:category>":491.0,
"author_id<gx:category>":491.0,
"user_favourites_count<gx:number>":491.0,
"user_followers_count<gx:number>":491.0,
"user_following_count<gx:number>":491.0,
"user_listed_count<gx:number>":491.0,
"user_tweets_count<gx:number>":491.0,
"retweets<gx:number>":491.0,
"favorites<gx:number>":491.0,
"replies<gx:number>":491.0,
"quotes<gx:number>":491.0
},
"mean":{
"id<gx:category>":1.230895609e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30218726.7454175167,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0590631365,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":5200.4623217923,
"favorites<gx:number>":41536.8635437882,
"replies<gx:number>":2056.5600814664,
"quotes<gx:number>":754.8859470468
},
"std":{
"id<gx:category>":7.194010391e+16,
"author_id<gx:category>":0.0,
"user_favourites_count<gx:number>":0.0,
"user_followers_count<gx:number>":23210.2101437425,
"user_following_count<gx:number>":0.0,
"user_listed_count<gx:number>":0.2526882771,
"user_tweets_count<gx:number>":0.0,
"retweets<gx:number>":13471.3749539952,
"favorites<gx:number>":99344.577018021,
"replies<gx:number>":3666.4962808525,
"quotes<gx:number>":3078.002195837
},
"min":{
"id<gx:category>":1.100456021e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212691.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36166.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":85.0,
"favorites<gx:number>":393.0,
"replies<gx:number>":22.0,
"quotes<gx:number>":0.0
},
"25%":{
"id<gx:category>":1.16465648e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212703.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":249.0,
"favorites<gx:number>":1245.5,
"replies<gx:number>":156.0,
"quotes<gx:number>":22.0
},
"50%":{
"id<gx:category>":1.229553614e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212708.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":1218.0,
"favorites<gx:number>":5730.0,
"replies<gx:number>":552.0,
"quotes<gx:number>":90.0
},
"75%":{
"id<gx:category>":1.296563283e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212712.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":4589.5,
"favorites<gx:number>":28466.5,
"replies<gx:number>":2210.0,
"quotes<gx:number>":444.0
},
"max":{
"id<gx:category>":1.391422726e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30308047.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36168.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":205169.0,
"favorites<gx:number>":889245.0,
"replies<gx:number>":29351.0,
"quotes<gx:number>":57012.0
}
}
# Randome sample of 10 rows from the dataframe.
df_random_sample = {
"count":{
"id<gx:category>":491.0,
"author_id<gx:category>":491.0,
"user_favourites_count<gx:number>":491.0,
"user_followers_count<gx:number>":491.0,
"user_following_count<gx:number>":491.0,
"user_listed_count<gx:number>":491.0,
"user_tweets_count<gx:number>":491.0,
"retweets<gx:number>":491.0,
"favorites<gx:number>":491.0,
"replies<gx:number>":491.0,
"quotes<gx:number>":491.0
},
"mean":{
"id<gx:category>":1.230895609e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30218726.7454175167,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0590631365,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":5200.4623217923,
"favorites<gx:number>":41536.8635437882,
"replies<gx:number>":2056.5600814664,
"quotes<gx:number>":754.8859470468
},
"std":{
"id<gx:category>":7.194010391e+16,
"author_id<gx:category>":0.0,
"user_favourites_count<gx:number>":0.0,
"user_followers_count<gx:number>":23210.2101437425,
"user_following_count<gx:number>":0.0,
"user_listed_count<gx:number>":0.2526882771,
"user_tweets_count<gx:number>":0.0,
"retweets<gx:number>":13471.3749539952,
"favorites<gx:number>":99344.577018021,
"replies<gx:number>":3666.4962808525,
"quotes<gx:number>":3078.002195837
},
"min":{
"id<gx:category>":1.100456021e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212691.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36166.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":85.0,
"favorites<gx:number>":393.0,
"replies<gx:number>":22.0,
"quotes<gx:number>":0.0
},
"25%":{
"id<gx:category>":1.16465648e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212703.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":249.0,
"favorites<gx:number>":1245.5,
"replies<gx:number>":156.0,
"quotes<gx:number>":22.0
},
"50%":{
"id<gx:category>":1.229553614e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212708.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":1218.0,
"favorites<gx:number>":5730.0,
"replies<gx:number>":552.0,
"quotes<gx:number>":90.0
},
"75%":{
"id<gx:category>":1.296563283e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212712.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":4589.5,
"favorites<gx:number>":28466.5,
"replies<gx:number>":2210.0,
"quotes<gx:number>":444.0
},
"max":{
"id<gx:category>":1.391422726e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30308047.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36168.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":205169.0,
"favorites<gx:number>":889245.0,
"replies<gx:number>":29351.0,
"quotes<gx:number>":57012.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 authors have tweets which have received more than 10,000 favourites?
# 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 authors have tweets which have received more than 10,000 favourites?
df.columns = ['id<gx:category>', 'author_id<gx:category>', 'author_name<gx:category>', 'author_handler<gx:category>', 'author_avatar<gx:url>', 'user_created_at<gx:date>', 'user_description<gx:text>', 'user_favourites_count<gx:number>', 'user_followers_count<gx:number>', 'user_following_count<gx:number>', 'user_listed_count<gx:number>', 'user_tweets_count<gx:number>', 'user_verified<gx:boolean>', 'user_location<gx:text>', 'lang<gx:category>', 'type<gx:category>', 'text<gx:text>', 'date<gx:date>', 'mention_ids<gx:list[category]>', 'mention_names<gx:list[category]>', 'retweets<gx:number>', 'favorites<gx:number>', 'replies<gx:number>', 'quotes<gx:number>', 'links<gx:list[url]>', 'links_first<gx:url>', 'image_links<gx:list[url]>', 'image_links_first<gx:url>', 'rp_user_id<gx:category>', 'rp_user_name<gx:category>', 'location<gx:text>', 'tweet_link<gx:url>', 'source<gx:text>', 'search<gx:category>']
# Expected output type: is number, this will be checked.
return | 20250129013716 |
86 | How many retweets does the most retweeted tweet have? | 054_Joe | dev | number | ['retweets<gx:number>'] | 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<gx:category>",
"type": "int64"
},
{
"name": "author_id<gx:category>",
"type": "uint32"
},
{
"name": "author_name<gx:category>",
"type": "category"
},
{
"name": "author_handler<gx:category>",
"type": "category"
},
{
"name": "author_avatar<gx:url>",
"type": "category"
},
{
"name": "user_created_at<gx:date>",
"type": "datetime64[ns, UTC]"
},
{
"name": "user_description<gx:text>",
"type": "category"
},
{
"name": "user_favourites_count<gx:number>",
"type": "uint8"
},
{
"name": "user_followers_count<gx:number>",
"type": "uint32"
},
{
"name": "user_following_count<gx:number>",
"type": "uint8"
},
{
"name": "user_listed_count<gx:number>",
"type": "uint16"
},
{
"name": "user_tweets_count<gx:number>",
"type": "uint16"
},
{
"name": "user_verified<gx:boolean>",
"type": "bool"
},
{
"name": "user_location<gx:text>",
"type": "category"
},
{
"name": "lang<gx:category>",
"type": "category"
},
{
"name": "type<gx:category>",
"type": "category"
},
{
"name": "text<gx:text>",
"type": "object"
},
{
"name": "date<gx:date>",
"type": "datetime64[ns, UTC]"
},
{
"name": "mention_ids<gx:list[category]>",
"type": "object"
},
{
"name": "mention_names<gx:list[category]>",
"type": "object"
},
{
"name": "retweets<gx:number>",
"type": "uint32"
},
{
"name": "favorites<gx:number>",
"type": "uint32"
},
{
"name": "replies<gx:number>",
"type": "uint16"
},
{
"name": "quotes<gx:number>",
"type": "uint16"
},
{
"name": "links<gx:list[url]>",
"type": "object"
},
{
"name": "links_first<gx:url>",
"type": "category"
},
{
"name": "image_links<gx:list[url]>",
"type": "object"
},
{
"name": "image_links_first<gx:url>",
"type": "category"
},
{
"name": "rp_user_id<gx:category>",
"type": "category"
},
{
"name": "rp_user_name<gx:category>",
"type": "category"
},
{
"name": "location<gx:text>",
"type": "category"
},
{
"name": "tweet_link<gx:url>",
"type": "category"
},
{
"name": "source<gx:text>",
"type": "category"
},
{
"name": "search<gx:category>",
"type": "category"
}
]
}
# Description of dataframe columns.
df_descrption = {
"count":{
"id<gx:category>":491.0,
"author_id<gx:category>":491.0,
"user_favourites_count<gx:number>":491.0,
"user_followers_count<gx:number>":491.0,
"user_following_count<gx:number>":491.0,
"user_listed_count<gx:number>":491.0,
"user_tweets_count<gx:number>":491.0,
"retweets<gx:number>":491.0,
"favorites<gx:number>":491.0,
"replies<gx:number>":491.0,
"quotes<gx:number>":491.0
},
"mean":{
"id<gx:category>":1.230895609e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30218726.7454175167,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0590631365,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":5200.4623217923,
"favorites<gx:number>":41536.8635437882,
"replies<gx:number>":2056.5600814664,
"quotes<gx:number>":754.8859470468
},
"std":{
"id<gx:category>":7.194010391e+16,
"author_id<gx:category>":0.0,
"user_favourites_count<gx:number>":0.0,
"user_followers_count<gx:number>":23210.2101437425,
"user_following_count<gx:number>":0.0,
"user_listed_count<gx:number>":0.2526882771,
"user_tweets_count<gx:number>":0.0,
"retweets<gx:number>":13471.3749539952,
"favorites<gx:number>":99344.577018021,
"replies<gx:number>":3666.4962808525,
"quotes<gx:number>":3078.002195837
},
"min":{
"id<gx:category>":1.100456021e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212691.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36166.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":85.0,
"favorites<gx:number>":393.0,
"replies<gx:number>":22.0,
"quotes<gx:number>":0.0
},
"25%":{
"id<gx:category>":1.16465648e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212703.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":249.0,
"favorites<gx:number>":1245.5,
"replies<gx:number>":156.0,
"quotes<gx:number>":22.0
},
"50%":{
"id<gx:category>":1.229553614e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212708.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":1218.0,
"favorites<gx:number>":5730.0,
"replies<gx:number>":552.0,
"quotes<gx:number>":90.0
},
"75%":{
"id<gx:category>":1.296563283e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212712.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":4589.5,
"favorites<gx:number>":28466.5,
"replies<gx:number>":2210.0,
"quotes<gx:number>":444.0
},
"max":{
"id<gx:category>":1.391422726e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30308047.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36168.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":205169.0,
"favorites<gx:number>":889245.0,
"replies<gx:number>":29351.0,
"quotes<gx:number>":57012.0
}
}
# Randome sample of 10 rows from the dataframe.
df_random_sample = {
"count":{
"id<gx:category>":491.0,
"author_id<gx:category>":491.0,
"user_favourites_count<gx:number>":491.0,
"user_followers_count<gx:number>":491.0,
"user_following_count<gx:number>":491.0,
"user_listed_count<gx:number>":491.0,
"user_tweets_count<gx:number>":491.0,
"retweets<gx:number>":491.0,
"favorites<gx:number>":491.0,
"replies<gx:number>":491.0,
"quotes<gx:number>":491.0
},
"mean":{
"id<gx:category>":1.230895609e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30218726.7454175167,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0590631365,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":5200.4623217923,
"favorites<gx:number>":41536.8635437882,
"replies<gx:number>":2056.5600814664,
"quotes<gx:number>":754.8859470468
},
"std":{
"id<gx:category>":7.194010391e+16,
"author_id<gx:category>":0.0,
"user_favourites_count<gx:number>":0.0,
"user_followers_count<gx:number>":23210.2101437425,
"user_following_count<gx:number>":0.0,
"user_listed_count<gx:number>":0.2526882771,
"user_tweets_count<gx:number>":0.0,
"retweets<gx:number>":13471.3749539952,
"favorites<gx:number>":99344.577018021,
"replies<gx:number>":3666.4962808525,
"quotes<gx:number>":3078.002195837
},
"min":{
"id<gx:category>":1.100456021e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212691.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36166.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":85.0,
"favorites<gx:number>":393.0,
"replies<gx:number>":22.0,
"quotes<gx:number>":0.0
},
"25%":{
"id<gx:category>":1.16465648e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212703.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":249.0,
"favorites<gx:number>":1245.5,
"replies<gx:number>":156.0,
"quotes<gx:number>":22.0
},
"50%":{
"id<gx:category>":1.229553614e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212708.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":1218.0,
"favorites<gx:number>":5730.0,
"replies<gx:number>":552.0,
"quotes<gx:number>":90.0
},
"75%":{
"id<gx:category>":1.296563283e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212712.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":4589.5,
"favorites<gx:number>":28466.5,
"replies<gx:number>":2210.0,
"quotes<gx:number>":444.0
},
"max":{
"id<gx:category>":1.391422726e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30308047.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36168.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":205169.0,
"favorites<gx:number>":889245.0,
"replies<gx:number>":29351.0,
"quotes<gx:number>":57012.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 retweets does the most retweeted tweet 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: How many retweets does the most retweeted tweet have?
df.columns = ['id<gx:category>', 'author_id<gx:category>', 'author_name<gx:category>', 'author_handler<gx:category>', 'author_avatar<gx:url>', 'user_created_at<gx:date>', 'user_description<gx:text>', 'user_favourites_count<gx:number>', 'user_followers_count<gx:number>', 'user_following_count<gx:number>', 'user_listed_count<gx:number>', 'user_tweets_count<gx:number>', 'user_verified<gx:boolean>', 'user_location<gx:text>', 'lang<gx:category>', 'type<gx:category>', 'text<gx:text>', 'date<gx:date>', 'mention_ids<gx:list[category]>', 'mention_names<gx:list[category]>', 'retweets<gx:number>', 'favorites<gx:number>', 'replies<gx:number>', 'quotes<gx:number>', 'links<gx:list[url]>', 'links_first<gx:url>', 'image_links<gx:list[url]>', 'image_links_first<gx:url>', 'rp_user_id<gx:category>', 'rp_user_name<gx:category>', 'location<gx:text>', 'tweet_link<gx:url>', 'source<gx:text>', 'search<gx:category>']
# Expected output type: is number, this will be checked.
return | 20250129013716 |
87 | How many times has the most mentioned user been mentioned? | 054_Joe | dev | number | ['mention_names<gx:list[category]>'] | 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<gx:category>",
"type": "int64"
},
{
"name": "author_id<gx:category>",
"type": "uint32"
},
{
"name": "author_name<gx:category>",
"type": "category"
},
{
"name": "author_handler<gx:category>",
"type": "category"
},
{
"name": "author_avatar<gx:url>",
"type": "category"
},
{
"name": "user_created_at<gx:date>",
"type": "datetime64[ns, UTC]"
},
{
"name": "user_description<gx:text>",
"type": "category"
},
{
"name": "user_favourites_count<gx:number>",
"type": "uint8"
},
{
"name": "user_followers_count<gx:number>",
"type": "uint32"
},
{
"name": "user_following_count<gx:number>",
"type": "uint8"
},
{
"name": "user_listed_count<gx:number>",
"type": "uint16"
},
{
"name": "user_tweets_count<gx:number>",
"type": "uint16"
},
{
"name": "user_verified<gx:boolean>",
"type": "bool"
},
{
"name": "user_location<gx:text>",
"type": "category"
},
{
"name": "lang<gx:category>",
"type": "category"
},
{
"name": "type<gx:category>",
"type": "category"
},
{
"name": "text<gx:text>",
"type": "object"
},
{
"name": "date<gx:date>",
"type": "datetime64[ns, UTC]"
},
{
"name": "mention_ids<gx:list[category]>",
"type": "object"
},
{
"name": "mention_names<gx:list[category]>",
"type": "object"
},
{
"name": "retweets<gx:number>",
"type": "uint32"
},
{
"name": "favorites<gx:number>",
"type": "uint32"
},
{
"name": "replies<gx:number>",
"type": "uint16"
},
{
"name": "quotes<gx:number>",
"type": "uint16"
},
{
"name": "links<gx:list[url]>",
"type": "object"
},
{
"name": "links_first<gx:url>",
"type": "category"
},
{
"name": "image_links<gx:list[url]>",
"type": "object"
},
{
"name": "image_links_first<gx:url>",
"type": "category"
},
{
"name": "rp_user_id<gx:category>",
"type": "category"
},
{
"name": "rp_user_name<gx:category>",
"type": "category"
},
{
"name": "location<gx:text>",
"type": "category"
},
{
"name": "tweet_link<gx:url>",
"type": "category"
},
{
"name": "source<gx:text>",
"type": "category"
},
{
"name": "search<gx:category>",
"type": "category"
}
]
}
# Description of dataframe columns.
df_descrption = {
"count":{
"id<gx:category>":491.0,
"author_id<gx:category>":491.0,
"user_favourites_count<gx:number>":491.0,
"user_followers_count<gx:number>":491.0,
"user_following_count<gx:number>":491.0,
"user_listed_count<gx:number>":491.0,
"user_tweets_count<gx:number>":491.0,
"retweets<gx:number>":491.0,
"favorites<gx:number>":491.0,
"replies<gx:number>":491.0,
"quotes<gx:number>":491.0
},
"mean":{
"id<gx:category>":1.230895609e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30218726.7454175167,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0590631365,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":5200.4623217923,
"favorites<gx:number>":41536.8635437882,
"replies<gx:number>":2056.5600814664,
"quotes<gx:number>":754.8859470468
},
"std":{
"id<gx:category>":7.194010391e+16,
"author_id<gx:category>":0.0,
"user_favourites_count<gx:number>":0.0,
"user_followers_count<gx:number>":23210.2101437425,
"user_following_count<gx:number>":0.0,
"user_listed_count<gx:number>":0.2526882771,
"user_tweets_count<gx:number>":0.0,
"retweets<gx:number>":13471.3749539952,
"favorites<gx:number>":99344.577018021,
"replies<gx:number>":3666.4962808525,
"quotes<gx:number>":3078.002195837
},
"min":{
"id<gx:category>":1.100456021e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212691.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36166.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":85.0,
"favorites<gx:number>":393.0,
"replies<gx:number>":22.0,
"quotes<gx:number>":0.0
},
"25%":{
"id<gx:category>":1.16465648e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212703.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":249.0,
"favorites<gx:number>":1245.5,
"replies<gx:number>":156.0,
"quotes<gx:number>":22.0
},
"50%":{
"id<gx:category>":1.229553614e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212708.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":1218.0,
"favorites<gx:number>":5730.0,
"replies<gx:number>":552.0,
"quotes<gx:number>":90.0
},
"75%":{
"id<gx:category>":1.296563283e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212712.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":4589.5,
"favorites<gx:number>":28466.5,
"replies<gx:number>":2210.0,
"quotes<gx:number>":444.0
},
"max":{
"id<gx:category>":1.391422726e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30308047.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36168.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":205169.0,
"favorites<gx:number>":889245.0,
"replies<gx:number>":29351.0,
"quotes<gx:number>":57012.0
}
}
# Randome sample of 10 rows from the dataframe.
df_random_sample = {
"count":{
"id<gx:category>":491.0,
"author_id<gx:category>":491.0,
"user_favourites_count<gx:number>":491.0,
"user_followers_count<gx:number>":491.0,
"user_following_count<gx:number>":491.0,
"user_listed_count<gx:number>":491.0,
"user_tweets_count<gx:number>":491.0,
"retweets<gx:number>":491.0,
"favorites<gx:number>":491.0,
"replies<gx:number>":491.0,
"quotes<gx:number>":491.0
},
"mean":{
"id<gx:category>":1.230895609e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30218726.7454175167,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0590631365,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":5200.4623217923,
"favorites<gx:number>":41536.8635437882,
"replies<gx:number>":2056.5600814664,
"quotes<gx:number>":754.8859470468
},
"std":{
"id<gx:category>":7.194010391e+16,
"author_id<gx:category>":0.0,
"user_favourites_count<gx:number>":0.0,
"user_followers_count<gx:number>":23210.2101437425,
"user_following_count<gx:number>":0.0,
"user_listed_count<gx:number>":0.2526882771,
"user_tweets_count<gx:number>":0.0,
"retweets<gx:number>":13471.3749539952,
"favorites<gx:number>":99344.577018021,
"replies<gx:number>":3666.4962808525,
"quotes<gx:number>":3078.002195837
},
"min":{
"id<gx:category>":1.100456021e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212691.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36166.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":85.0,
"favorites<gx:number>":393.0,
"replies<gx:number>":22.0,
"quotes<gx:number>":0.0
},
"25%":{
"id<gx:category>":1.16465648e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212703.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":249.0,
"favorites<gx:number>":1245.5,
"replies<gx:number>":156.0,
"quotes<gx:number>":22.0
},
"50%":{
"id<gx:category>":1.229553614e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212708.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":1218.0,
"favorites<gx:number>":5730.0,
"replies<gx:number>":552.0,
"quotes<gx:number>":90.0
},
"75%":{
"id<gx:category>":1.296563283e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212712.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":4589.5,
"favorites<gx:number>":28466.5,
"replies<gx:number>":2210.0,
"quotes<gx:number>":444.0
},
"max":{
"id<gx:category>":1.391422726e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30308047.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36168.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":205169.0,
"favorites<gx:number>":889245.0,
"replies<gx:number>":29351.0,
"quotes<gx:number>":57012.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 times has the most mentioned user been mentioned?
# 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 times has the most mentioned user been mentioned?
df.columns = ['id<gx:category>', 'author_id<gx:category>', 'author_name<gx:category>', 'author_handler<gx:category>', 'author_avatar<gx:url>', 'user_created_at<gx:date>', 'user_description<gx:text>', 'user_favourites_count<gx:number>', 'user_followers_count<gx:number>', 'user_following_count<gx:number>', 'user_listed_count<gx:number>', 'user_tweets_count<gx:number>', 'user_verified<gx:boolean>', 'user_location<gx:text>', 'lang<gx:category>', 'type<gx:category>', 'text<gx:text>', 'date<gx:date>', 'mention_ids<gx:list[category]>', 'mention_names<gx:list[category]>', 'retweets<gx:number>', 'favorites<gx:number>', 'replies<gx:number>', 'quotes<gx:number>', 'links<gx:list[url]>', 'links_first<gx:url>', 'image_links<gx:list[url]>', 'image_links_first<gx:url>', 'rp_user_id<gx:category>', 'rp_user_name<gx:category>', 'location<gx:text>', 'tweet_link<gx:url>', 'source<gx:text>', 'search<gx:category>']
# Expected output type: is number, this will be checked.
return | 20250129013716 |
88 | Who is the author with the most followers? | 054_Joe | dev | category | ['author_name<gx:category>', 'user_followers_count<gx:number>'] | 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<gx:category>",
"type": "int64"
},
{
"name": "author_id<gx:category>",
"type": "uint32"
},
{
"name": "author_name<gx:category>",
"type": "category"
},
{
"name": "author_handler<gx:category>",
"type": "category"
},
{
"name": "author_avatar<gx:url>",
"type": "category"
},
{
"name": "user_created_at<gx:date>",
"type": "datetime64[ns, UTC]"
},
{
"name": "user_description<gx:text>",
"type": "category"
},
{
"name": "user_favourites_count<gx:number>",
"type": "uint8"
},
{
"name": "user_followers_count<gx:number>",
"type": "uint32"
},
{
"name": "user_following_count<gx:number>",
"type": "uint8"
},
{
"name": "user_listed_count<gx:number>",
"type": "uint16"
},
{
"name": "user_tweets_count<gx:number>",
"type": "uint16"
},
{
"name": "user_verified<gx:boolean>",
"type": "bool"
},
{
"name": "user_location<gx:text>",
"type": "category"
},
{
"name": "lang<gx:category>",
"type": "category"
},
{
"name": "type<gx:category>",
"type": "category"
},
{
"name": "text<gx:text>",
"type": "object"
},
{
"name": "date<gx:date>",
"type": "datetime64[ns, UTC]"
},
{
"name": "mention_ids<gx:list[category]>",
"type": "object"
},
{
"name": "mention_names<gx:list[category]>",
"type": "object"
},
{
"name": "retweets<gx:number>",
"type": "uint32"
},
{
"name": "favorites<gx:number>",
"type": "uint32"
},
{
"name": "replies<gx:number>",
"type": "uint16"
},
{
"name": "quotes<gx:number>",
"type": "uint16"
},
{
"name": "links<gx:list[url]>",
"type": "object"
},
{
"name": "links_first<gx:url>",
"type": "category"
},
{
"name": "image_links<gx:list[url]>",
"type": "object"
},
{
"name": "image_links_first<gx:url>",
"type": "category"
},
{
"name": "rp_user_id<gx:category>",
"type": "category"
},
{
"name": "rp_user_name<gx:category>",
"type": "category"
},
{
"name": "location<gx:text>",
"type": "category"
},
{
"name": "tweet_link<gx:url>",
"type": "category"
},
{
"name": "source<gx:text>",
"type": "category"
},
{
"name": "search<gx:category>",
"type": "category"
}
]
}
# Description of dataframe columns.
df_descrption = {
"count":{
"id<gx:category>":491.0,
"author_id<gx:category>":491.0,
"user_favourites_count<gx:number>":491.0,
"user_followers_count<gx:number>":491.0,
"user_following_count<gx:number>":491.0,
"user_listed_count<gx:number>":491.0,
"user_tweets_count<gx:number>":491.0,
"retweets<gx:number>":491.0,
"favorites<gx:number>":491.0,
"replies<gx:number>":491.0,
"quotes<gx:number>":491.0
},
"mean":{
"id<gx:category>":1.230895609e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30218726.7454175167,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0590631365,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":5200.4623217923,
"favorites<gx:number>":41536.8635437882,
"replies<gx:number>":2056.5600814664,
"quotes<gx:number>":754.8859470468
},
"std":{
"id<gx:category>":7.194010391e+16,
"author_id<gx:category>":0.0,
"user_favourites_count<gx:number>":0.0,
"user_followers_count<gx:number>":23210.2101437425,
"user_following_count<gx:number>":0.0,
"user_listed_count<gx:number>":0.2526882771,
"user_tweets_count<gx:number>":0.0,
"retweets<gx:number>":13471.3749539952,
"favorites<gx:number>":99344.577018021,
"replies<gx:number>":3666.4962808525,
"quotes<gx:number>":3078.002195837
},
"min":{
"id<gx:category>":1.100456021e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212691.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36166.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":85.0,
"favorites<gx:number>":393.0,
"replies<gx:number>":22.0,
"quotes<gx:number>":0.0
},
"25%":{
"id<gx:category>":1.16465648e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212703.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":249.0,
"favorites<gx:number>":1245.5,
"replies<gx:number>":156.0,
"quotes<gx:number>":22.0
},
"50%":{
"id<gx:category>":1.229553614e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212708.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":1218.0,
"favorites<gx:number>":5730.0,
"replies<gx:number>":552.0,
"quotes<gx:number>":90.0
},
"75%":{
"id<gx:category>":1.296563283e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212712.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":4589.5,
"favorites<gx:number>":28466.5,
"replies<gx:number>":2210.0,
"quotes<gx:number>":444.0
},
"max":{
"id<gx:category>":1.391422726e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30308047.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36168.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":205169.0,
"favorites<gx:number>":889245.0,
"replies<gx:number>":29351.0,
"quotes<gx:number>":57012.0
}
}
# Randome sample of 10 rows from the dataframe.
df_random_sample = {
"count":{
"id<gx:category>":491.0,
"author_id<gx:category>":491.0,
"user_favourites_count<gx:number>":491.0,
"user_followers_count<gx:number>":491.0,
"user_following_count<gx:number>":491.0,
"user_listed_count<gx:number>":491.0,
"user_tweets_count<gx:number>":491.0,
"retweets<gx:number>":491.0,
"favorites<gx:number>":491.0,
"replies<gx:number>":491.0,
"quotes<gx:number>":491.0
},
"mean":{
"id<gx:category>":1.230895609e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30218726.7454175167,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0590631365,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":5200.4623217923,
"favorites<gx:number>":41536.8635437882,
"replies<gx:number>":2056.5600814664,
"quotes<gx:number>":754.8859470468
},
"std":{
"id<gx:category>":7.194010391e+16,
"author_id<gx:category>":0.0,
"user_favourites_count<gx:number>":0.0,
"user_followers_count<gx:number>":23210.2101437425,
"user_following_count<gx:number>":0.0,
"user_listed_count<gx:number>":0.2526882771,
"user_tweets_count<gx:number>":0.0,
"retweets<gx:number>":13471.3749539952,
"favorites<gx:number>":99344.577018021,
"replies<gx:number>":3666.4962808525,
"quotes<gx:number>":3078.002195837
},
"min":{
"id<gx:category>":1.100456021e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212691.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36166.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":85.0,
"favorites<gx:number>":393.0,
"replies<gx:number>":22.0,
"quotes<gx:number>":0.0
},
"25%":{
"id<gx:category>":1.16465648e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212703.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":249.0,
"favorites<gx:number>":1245.5,
"replies<gx:number>":156.0,
"quotes<gx:number>":22.0
},
"50%":{
"id<gx:category>":1.229553614e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212708.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":1218.0,
"favorites<gx:number>":5730.0,
"replies<gx:number>":552.0,
"quotes<gx:number>":90.0
},
"75%":{
"id<gx:category>":1.296563283e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212712.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":4589.5,
"favorites<gx:number>":28466.5,
"replies<gx:number>":2210.0,
"quotes<gx:number>":444.0
},
"max":{
"id<gx:category>":1.391422726e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30308047.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36168.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":205169.0,
"favorites<gx:number>":889245.0,
"replies<gx:number>":29351.0,
"quotes<gx:number>":57012.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: Who is the author with the most followers?
# The answer should only contain python code, you are not allowed leave any TODO undone.
def answer(df: pd.DataFrame):
# Use df to answer: Who is the author with the most followers?
df.columns = ['id<gx:category>', 'author_id<gx:category>', 'author_name<gx:category>', 'author_handler<gx:category>', 'author_avatar<gx:url>', 'user_created_at<gx:date>', 'user_description<gx:text>', 'user_favourites_count<gx:number>', 'user_followers_count<gx:number>', 'user_following_count<gx:number>', 'user_listed_count<gx:number>', 'user_tweets_count<gx:number>', 'user_verified<gx:boolean>', 'user_location<gx:text>', 'lang<gx:category>', 'type<gx:category>', 'text<gx:text>', 'date<gx:date>', 'mention_ids<gx:list[category]>', 'mention_names<gx:list[category]>', 'retweets<gx:number>', 'favorites<gx:number>', 'replies<gx:number>', 'quotes<gx:number>', 'links<gx:list[url]>', 'links_first<gx:url>', 'image_links<gx:list[url]>', 'image_links_first<gx:url>', 'rp_user_id<gx:category>', 'rp_user_name<gx:category>', 'location<gx:text>', 'tweet_link<gx:url>', 'source<gx:text>', 'search<gx:category>']
# Expected output type: is category, this will be checked.
return | 20250129013716 |
89 | Who is the author with the highest number of user favourites? | 054_Joe | dev | category | ['author_name<gx:category>', 'user_favourites_count<gx:number>'] | 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<gx:category>",
"type": "int64"
},
{
"name": "author_id<gx:category>",
"type": "uint32"
},
{
"name": "author_name<gx:category>",
"type": "category"
},
{
"name": "author_handler<gx:category>",
"type": "category"
},
{
"name": "author_avatar<gx:url>",
"type": "category"
},
{
"name": "user_created_at<gx:date>",
"type": "datetime64[ns, UTC]"
},
{
"name": "user_description<gx:text>",
"type": "category"
},
{
"name": "user_favourites_count<gx:number>",
"type": "uint8"
},
{
"name": "user_followers_count<gx:number>",
"type": "uint32"
},
{
"name": "user_following_count<gx:number>",
"type": "uint8"
},
{
"name": "user_listed_count<gx:number>",
"type": "uint16"
},
{
"name": "user_tweets_count<gx:number>",
"type": "uint16"
},
{
"name": "user_verified<gx:boolean>",
"type": "bool"
},
{
"name": "user_location<gx:text>",
"type": "category"
},
{
"name": "lang<gx:category>",
"type": "category"
},
{
"name": "type<gx:category>",
"type": "category"
},
{
"name": "text<gx:text>",
"type": "object"
},
{
"name": "date<gx:date>",
"type": "datetime64[ns, UTC]"
},
{
"name": "mention_ids<gx:list[category]>",
"type": "object"
},
{
"name": "mention_names<gx:list[category]>",
"type": "object"
},
{
"name": "retweets<gx:number>",
"type": "uint32"
},
{
"name": "favorites<gx:number>",
"type": "uint32"
},
{
"name": "replies<gx:number>",
"type": "uint16"
},
{
"name": "quotes<gx:number>",
"type": "uint16"
},
{
"name": "links<gx:list[url]>",
"type": "object"
},
{
"name": "links_first<gx:url>",
"type": "category"
},
{
"name": "image_links<gx:list[url]>",
"type": "object"
},
{
"name": "image_links_first<gx:url>",
"type": "category"
},
{
"name": "rp_user_id<gx:category>",
"type": "category"
},
{
"name": "rp_user_name<gx:category>",
"type": "category"
},
{
"name": "location<gx:text>",
"type": "category"
},
{
"name": "tweet_link<gx:url>",
"type": "category"
},
{
"name": "source<gx:text>",
"type": "category"
},
{
"name": "search<gx:category>",
"type": "category"
}
]
}
# Description of dataframe columns.
df_descrption = {
"count":{
"id<gx:category>":491.0,
"author_id<gx:category>":491.0,
"user_favourites_count<gx:number>":491.0,
"user_followers_count<gx:number>":491.0,
"user_following_count<gx:number>":491.0,
"user_listed_count<gx:number>":491.0,
"user_tweets_count<gx:number>":491.0,
"retweets<gx:number>":491.0,
"favorites<gx:number>":491.0,
"replies<gx:number>":491.0,
"quotes<gx:number>":491.0
},
"mean":{
"id<gx:category>":1.230895609e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30218726.7454175167,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0590631365,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":5200.4623217923,
"favorites<gx:number>":41536.8635437882,
"replies<gx:number>":2056.5600814664,
"quotes<gx:number>":754.8859470468
},
"std":{
"id<gx:category>":7.194010391e+16,
"author_id<gx:category>":0.0,
"user_favourites_count<gx:number>":0.0,
"user_followers_count<gx:number>":23210.2101437425,
"user_following_count<gx:number>":0.0,
"user_listed_count<gx:number>":0.2526882771,
"user_tweets_count<gx:number>":0.0,
"retweets<gx:number>":13471.3749539952,
"favorites<gx:number>":99344.577018021,
"replies<gx:number>":3666.4962808525,
"quotes<gx:number>":3078.002195837
},
"min":{
"id<gx:category>":1.100456021e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212691.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36166.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":85.0,
"favorites<gx:number>":393.0,
"replies<gx:number>":22.0,
"quotes<gx:number>":0.0
},
"25%":{
"id<gx:category>":1.16465648e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212703.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":249.0,
"favorites<gx:number>":1245.5,
"replies<gx:number>":156.0,
"quotes<gx:number>":22.0
},
"50%":{
"id<gx:category>":1.229553614e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212708.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":1218.0,
"favorites<gx:number>":5730.0,
"replies<gx:number>":552.0,
"quotes<gx:number>":90.0
},
"75%":{
"id<gx:category>":1.296563283e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212712.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":4589.5,
"favorites<gx:number>":28466.5,
"replies<gx:number>":2210.0,
"quotes<gx:number>":444.0
},
"max":{
"id<gx:category>":1.391422726e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30308047.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36168.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":205169.0,
"favorites<gx:number>":889245.0,
"replies<gx:number>":29351.0,
"quotes<gx:number>":57012.0
}
}
# Randome sample of 10 rows from the dataframe.
df_random_sample = {
"count":{
"id<gx:category>":491.0,
"author_id<gx:category>":491.0,
"user_favourites_count<gx:number>":491.0,
"user_followers_count<gx:number>":491.0,
"user_following_count<gx:number>":491.0,
"user_listed_count<gx:number>":491.0,
"user_tweets_count<gx:number>":491.0,
"retweets<gx:number>":491.0,
"favorites<gx:number>":491.0,
"replies<gx:number>":491.0,
"quotes<gx:number>":491.0
},
"mean":{
"id<gx:category>":1.230895609e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30218726.7454175167,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0590631365,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":5200.4623217923,
"favorites<gx:number>":41536.8635437882,
"replies<gx:number>":2056.5600814664,
"quotes<gx:number>":754.8859470468
},
"std":{
"id<gx:category>":7.194010391e+16,
"author_id<gx:category>":0.0,
"user_favourites_count<gx:number>":0.0,
"user_followers_count<gx:number>":23210.2101437425,
"user_following_count<gx:number>":0.0,
"user_listed_count<gx:number>":0.2526882771,
"user_tweets_count<gx:number>":0.0,
"retweets<gx:number>":13471.3749539952,
"favorites<gx:number>":99344.577018021,
"replies<gx:number>":3666.4962808525,
"quotes<gx:number>":3078.002195837
},
"min":{
"id<gx:category>":1.100456021e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212691.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36166.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":85.0,
"favorites<gx:number>":393.0,
"replies<gx:number>":22.0,
"quotes<gx:number>":0.0
},
"25%":{
"id<gx:category>":1.16465648e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212703.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":249.0,
"favorites<gx:number>":1245.5,
"replies<gx:number>":156.0,
"quotes<gx:number>":22.0
},
"50%":{
"id<gx:category>":1.229553614e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212708.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":1218.0,
"favorites<gx:number>":5730.0,
"replies<gx:number>":552.0,
"quotes<gx:number>":90.0
},
"75%":{
"id<gx:category>":1.296563283e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212712.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":4589.5,
"favorites<gx:number>":28466.5,
"replies<gx:number>":2210.0,
"quotes<gx:number>":444.0
},
"max":{
"id<gx:category>":1.391422726e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30308047.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36168.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":205169.0,
"favorites<gx:number>":889245.0,
"replies<gx:number>":29351.0,
"quotes<gx:number>":57012.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: Who is the author with the highest number of user favourites?
# The answer should only contain python code, you are not allowed leave any TODO undone.
def answer(df: pd.DataFrame):
# Use df to answer: Who is the author with the highest number of user favourites?
df.columns = ['id<gx:category>', 'author_id<gx:category>', 'author_name<gx:category>', 'author_handler<gx:category>', 'author_avatar<gx:url>', 'user_created_at<gx:date>', 'user_description<gx:text>', 'user_favourites_count<gx:number>', 'user_followers_count<gx:number>', 'user_following_count<gx:number>', 'user_listed_count<gx:number>', 'user_tweets_count<gx:number>', 'user_verified<gx:boolean>', 'user_location<gx:text>', 'lang<gx:category>', 'type<gx:category>', 'text<gx:text>', 'date<gx:date>', 'mention_ids<gx:list[category]>', 'mention_names<gx:list[category]>', 'retweets<gx:number>', 'favorites<gx:number>', 'replies<gx:number>', 'quotes<gx:number>', 'links<gx:list[url]>', 'links_first<gx:url>', 'image_links<gx:list[url]>', 'image_links_first<gx:url>', 'rp_user_id<gx:category>', 'rp_user_name<gx:category>', 'location<gx:text>', 'tweet_link<gx:url>', 'source<gx:text>', 'search<gx:category>']
# Expected output type: is category, this will be checked.
return | 20250129013716 |
90 | What is the name of the user who is most often named in the dataset? | 054_Joe | dev | category | ['author_name<gx:category>', 'mention_names<gx:list[category]>'] | 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<gx:category>",
"type": "int64"
},
{
"name": "author_id<gx:category>",
"type": "uint32"
},
{
"name": "author_name<gx:category>",
"type": "category"
},
{
"name": "author_handler<gx:category>",
"type": "category"
},
{
"name": "author_avatar<gx:url>",
"type": "category"
},
{
"name": "user_created_at<gx:date>",
"type": "datetime64[ns, UTC]"
},
{
"name": "user_description<gx:text>",
"type": "category"
},
{
"name": "user_favourites_count<gx:number>",
"type": "uint8"
},
{
"name": "user_followers_count<gx:number>",
"type": "uint32"
},
{
"name": "user_following_count<gx:number>",
"type": "uint8"
},
{
"name": "user_listed_count<gx:number>",
"type": "uint16"
},
{
"name": "user_tweets_count<gx:number>",
"type": "uint16"
},
{
"name": "user_verified<gx:boolean>",
"type": "bool"
},
{
"name": "user_location<gx:text>",
"type": "category"
},
{
"name": "lang<gx:category>",
"type": "category"
},
{
"name": "type<gx:category>",
"type": "category"
},
{
"name": "text<gx:text>",
"type": "object"
},
{
"name": "date<gx:date>",
"type": "datetime64[ns, UTC]"
},
{
"name": "mention_ids<gx:list[category]>",
"type": "object"
},
{
"name": "mention_names<gx:list[category]>",
"type": "object"
},
{
"name": "retweets<gx:number>",
"type": "uint32"
},
{
"name": "favorites<gx:number>",
"type": "uint32"
},
{
"name": "replies<gx:number>",
"type": "uint16"
},
{
"name": "quotes<gx:number>",
"type": "uint16"
},
{
"name": "links<gx:list[url]>",
"type": "object"
},
{
"name": "links_first<gx:url>",
"type": "category"
},
{
"name": "image_links<gx:list[url]>",
"type": "object"
},
{
"name": "image_links_first<gx:url>",
"type": "category"
},
{
"name": "rp_user_id<gx:category>",
"type": "category"
},
{
"name": "rp_user_name<gx:category>",
"type": "category"
},
{
"name": "location<gx:text>",
"type": "category"
},
{
"name": "tweet_link<gx:url>",
"type": "category"
},
{
"name": "source<gx:text>",
"type": "category"
},
{
"name": "search<gx:category>",
"type": "category"
}
]
}
# Description of dataframe columns.
df_descrption = {
"count":{
"id<gx:category>":491.0,
"author_id<gx:category>":491.0,
"user_favourites_count<gx:number>":491.0,
"user_followers_count<gx:number>":491.0,
"user_following_count<gx:number>":491.0,
"user_listed_count<gx:number>":491.0,
"user_tweets_count<gx:number>":491.0,
"retweets<gx:number>":491.0,
"favorites<gx:number>":491.0,
"replies<gx:number>":491.0,
"quotes<gx:number>":491.0
},
"mean":{
"id<gx:category>":1.230895609e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30218726.7454175167,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0590631365,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":5200.4623217923,
"favorites<gx:number>":41536.8635437882,
"replies<gx:number>":2056.5600814664,
"quotes<gx:number>":754.8859470468
},
"std":{
"id<gx:category>":7.194010391e+16,
"author_id<gx:category>":0.0,
"user_favourites_count<gx:number>":0.0,
"user_followers_count<gx:number>":23210.2101437425,
"user_following_count<gx:number>":0.0,
"user_listed_count<gx:number>":0.2526882771,
"user_tweets_count<gx:number>":0.0,
"retweets<gx:number>":13471.3749539952,
"favorites<gx:number>":99344.577018021,
"replies<gx:number>":3666.4962808525,
"quotes<gx:number>":3078.002195837
},
"min":{
"id<gx:category>":1.100456021e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212691.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36166.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":85.0,
"favorites<gx:number>":393.0,
"replies<gx:number>":22.0,
"quotes<gx:number>":0.0
},
"25%":{
"id<gx:category>":1.16465648e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212703.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":249.0,
"favorites<gx:number>":1245.5,
"replies<gx:number>":156.0,
"quotes<gx:number>":22.0
},
"50%":{
"id<gx:category>":1.229553614e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212708.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":1218.0,
"favorites<gx:number>":5730.0,
"replies<gx:number>":552.0,
"quotes<gx:number>":90.0
},
"75%":{
"id<gx:category>":1.296563283e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212712.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":4589.5,
"favorites<gx:number>":28466.5,
"replies<gx:number>":2210.0,
"quotes<gx:number>":444.0
},
"max":{
"id<gx:category>":1.391422726e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30308047.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36168.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":205169.0,
"favorites<gx:number>":889245.0,
"replies<gx:number>":29351.0,
"quotes<gx:number>":57012.0
}
}
# Randome sample of 10 rows from the dataframe.
df_random_sample = {
"count":{
"id<gx:category>":491.0,
"author_id<gx:category>":491.0,
"user_favourites_count<gx:number>":491.0,
"user_followers_count<gx:number>":491.0,
"user_following_count<gx:number>":491.0,
"user_listed_count<gx:number>":491.0,
"user_tweets_count<gx:number>":491.0,
"retweets<gx:number>":491.0,
"favorites<gx:number>":491.0,
"replies<gx:number>":491.0,
"quotes<gx:number>":491.0
},
"mean":{
"id<gx:category>":1.230895609e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30218726.7454175167,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0590631365,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":5200.4623217923,
"favorites<gx:number>":41536.8635437882,
"replies<gx:number>":2056.5600814664,
"quotes<gx:number>":754.8859470468
},
"std":{
"id<gx:category>":7.194010391e+16,
"author_id<gx:category>":0.0,
"user_favourites_count<gx:number>":0.0,
"user_followers_count<gx:number>":23210.2101437425,
"user_following_count<gx:number>":0.0,
"user_listed_count<gx:number>":0.2526882771,
"user_tweets_count<gx:number>":0.0,
"retweets<gx:number>":13471.3749539952,
"favorites<gx:number>":99344.577018021,
"replies<gx:number>":3666.4962808525,
"quotes<gx:number>":3078.002195837
},
"min":{
"id<gx:category>":1.100456021e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212691.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36166.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":85.0,
"favorites<gx:number>":393.0,
"replies<gx:number>":22.0,
"quotes<gx:number>":0.0
},
"25%":{
"id<gx:category>":1.16465648e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212703.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":249.0,
"favorites<gx:number>":1245.5,
"replies<gx:number>":156.0,
"quotes<gx:number>":22.0
},
"50%":{
"id<gx:category>":1.229553614e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212708.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":1218.0,
"favorites<gx:number>":5730.0,
"replies<gx:number>":552.0,
"quotes<gx:number>":90.0
},
"75%":{
"id<gx:category>":1.296563283e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212712.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":4589.5,
"favorites<gx:number>":28466.5,
"replies<gx:number>":2210.0,
"quotes<gx:number>":444.0
},
"max":{
"id<gx:category>":1.391422726e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30308047.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36168.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":205169.0,
"favorites<gx:number>":889245.0,
"replies<gx:number>":29351.0,
"quotes<gx:number>":57012.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 user who is most often named 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: What is the name of the user who is most often named in the dataset?
df.columns = ['id<gx:category>', 'author_id<gx:category>', 'author_name<gx:category>', 'author_handler<gx:category>', 'author_avatar<gx:url>', 'user_created_at<gx:date>', 'user_description<gx:text>', 'user_favourites_count<gx:number>', 'user_followers_count<gx:number>', 'user_following_count<gx:number>', 'user_listed_count<gx:number>', 'user_tweets_count<gx:number>', 'user_verified<gx:boolean>', 'user_location<gx:text>', 'lang<gx:category>', 'type<gx:category>', 'text<gx:text>', 'date<gx:date>', 'mention_ids<gx:list[category]>', 'mention_names<gx:list[category]>', 'retweets<gx:number>', 'favorites<gx:number>', 'replies<gx:number>', 'quotes<gx:number>', 'links<gx:list[url]>', 'links_first<gx:url>', 'image_links<gx:list[url]>', 'image_links_first<gx:url>', 'rp_user_id<gx:category>', 'rp_user_name<gx:category>', 'location<gx:text>', 'tweet_link<gx:url>', 'source<gx:text>', 'search<gx:category>']
# Expected output type: is category, this will be checked.
return | 20250129013717 |
91 | Who is the author of the tweet with the most retweets? | 054_Joe | dev | category | ['author_name<gx:category>', 'retweets<gx:number>'] | 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<gx:category>",
"type": "int64"
},
{
"name": "author_id<gx:category>",
"type": "uint32"
},
{
"name": "author_name<gx:category>",
"type": "category"
},
{
"name": "author_handler<gx:category>",
"type": "category"
},
{
"name": "author_avatar<gx:url>",
"type": "category"
},
{
"name": "user_created_at<gx:date>",
"type": "datetime64[ns, UTC]"
},
{
"name": "user_description<gx:text>",
"type": "category"
},
{
"name": "user_favourites_count<gx:number>",
"type": "uint8"
},
{
"name": "user_followers_count<gx:number>",
"type": "uint32"
},
{
"name": "user_following_count<gx:number>",
"type": "uint8"
},
{
"name": "user_listed_count<gx:number>",
"type": "uint16"
},
{
"name": "user_tweets_count<gx:number>",
"type": "uint16"
},
{
"name": "user_verified<gx:boolean>",
"type": "bool"
},
{
"name": "user_location<gx:text>",
"type": "category"
},
{
"name": "lang<gx:category>",
"type": "category"
},
{
"name": "type<gx:category>",
"type": "category"
},
{
"name": "text<gx:text>",
"type": "object"
},
{
"name": "date<gx:date>",
"type": "datetime64[ns, UTC]"
},
{
"name": "mention_ids<gx:list[category]>",
"type": "object"
},
{
"name": "mention_names<gx:list[category]>",
"type": "object"
},
{
"name": "retweets<gx:number>",
"type": "uint32"
},
{
"name": "favorites<gx:number>",
"type": "uint32"
},
{
"name": "replies<gx:number>",
"type": "uint16"
},
{
"name": "quotes<gx:number>",
"type": "uint16"
},
{
"name": "links<gx:list[url]>",
"type": "object"
},
{
"name": "links_first<gx:url>",
"type": "category"
},
{
"name": "image_links<gx:list[url]>",
"type": "object"
},
{
"name": "image_links_first<gx:url>",
"type": "category"
},
{
"name": "rp_user_id<gx:category>",
"type": "category"
},
{
"name": "rp_user_name<gx:category>",
"type": "category"
},
{
"name": "location<gx:text>",
"type": "category"
},
{
"name": "tweet_link<gx:url>",
"type": "category"
},
{
"name": "source<gx:text>",
"type": "category"
},
{
"name": "search<gx:category>",
"type": "category"
}
]
}
# Description of dataframe columns.
df_descrption = {
"count":{
"id<gx:category>":491.0,
"author_id<gx:category>":491.0,
"user_favourites_count<gx:number>":491.0,
"user_followers_count<gx:number>":491.0,
"user_following_count<gx:number>":491.0,
"user_listed_count<gx:number>":491.0,
"user_tweets_count<gx:number>":491.0,
"retweets<gx:number>":491.0,
"favorites<gx:number>":491.0,
"replies<gx:number>":491.0,
"quotes<gx:number>":491.0
},
"mean":{
"id<gx:category>":1.230895609e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30218726.7454175167,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0590631365,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":5200.4623217923,
"favorites<gx:number>":41536.8635437882,
"replies<gx:number>":2056.5600814664,
"quotes<gx:number>":754.8859470468
},
"std":{
"id<gx:category>":7.194010391e+16,
"author_id<gx:category>":0.0,
"user_favourites_count<gx:number>":0.0,
"user_followers_count<gx:number>":23210.2101437425,
"user_following_count<gx:number>":0.0,
"user_listed_count<gx:number>":0.2526882771,
"user_tweets_count<gx:number>":0.0,
"retweets<gx:number>":13471.3749539952,
"favorites<gx:number>":99344.577018021,
"replies<gx:number>":3666.4962808525,
"quotes<gx:number>":3078.002195837
},
"min":{
"id<gx:category>":1.100456021e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212691.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36166.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":85.0,
"favorites<gx:number>":393.0,
"replies<gx:number>":22.0,
"quotes<gx:number>":0.0
},
"25%":{
"id<gx:category>":1.16465648e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212703.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":249.0,
"favorites<gx:number>":1245.5,
"replies<gx:number>":156.0,
"quotes<gx:number>":22.0
},
"50%":{
"id<gx:category>":1.229553614e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212708.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":1218.0,
"favorites<gx:number>":5730.0,
"replies<gx:number>":552.0,
"quotes<gx:number>":90.0
},
"75%":{
"id<gx:category>":1.296563283e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212712.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":4589.5,
"favorites<gx:number>":28466.5,
"replies<gx:number>":2210.0,
"quotes<gx:number>":444.0
},
"max":{
"id<gx:category>":1.391422726e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30308047.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36168.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":205169.0,
"favorites<gx:number>":889245.0,
"replies<gx:number>":29351.0,
"quotes<gx:number>":57012.0
}
}
# Randome sample of 10 rows from the dataframe.
df_random_sample = {
"count":{
"id<gx:category>":491.0,
"author_id<gx:category>":491.0,
"user_favourites_count<gx:number>":491.0,
"user_followers_count<gx:number>":491.0,
"user_following_count<gx:number>":491.0,
"user_listed_count<gx:number>":491.0,
"user_tweets_count<gx:number>":491.0,
"retweets<gx:number>":491.0,
"favorites<gx:number>":491.0,
"replies<gx:number>":491.0,
"quotes<gx:number>":491.0
},
"mean":{
"id<gx:category>":1.230895609e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30218726.7454175167,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0590631365,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":5200.4623217923,
"favorites<gx:number>":41536.8635437882,
"replies<gx:number>":2056.5600814664,
"quotes<gx:number>":754.8859470468
},
"std":{
"id<gx:category>":7.194010391e+16,
"author_id<gx:category>":0.0,
"user_favourites_count<gx:number>":0.0,
"user_followers_count<gx:number>":23210.2101437425,
"user_following_count<gx:number>":0.0,
"user_listed_count<gx:number>":0.2526882771,
"user_tweets_count<gx:number>":0.0,
"retweets<gx:number>":13471.3749539952,
"favorites<gx:number>":99344.577018021,
"replies<gx:number>":3666.4962808525,
"quotes<gx:number>":3078.002195837
},
"min":{
"id<gx:category>":1.100456021e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212691.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36166.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":85.0,
"favorites<gx:number>":393.0,
"replies<gx:number>":22.0,
"quotes<gx:number>":0.0
},
"25%":{
"id<gx:category>":1.16465648e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212703.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":249.0,
"favorites<gx:number>":1245.5,
"replies<gx:number>":156.0,
"quotes<gx:number>":22.0
},
"50%":{
"id<gx:category>":1.229553614e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212708.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":1218.0,
"favorites<gx:number>":5730.0,
"replies<gx:number>":552.0,
"quotes<gx:number>":90.0
},
"75%":{
"id<gx:category>":1.296563283e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212712.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":4589.5,
"favorites<gx:number>":28466.5,
"replies<gx:number>":2210.0,
"quotes<gx:number>":444.0
},
"max":{
"id<gx:category>":1.391422726e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30308047.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36168.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":205169.0,
"favorites<gx:number>":889245.0,
"replies<gx:number>":29351.0,
"quotes<gx:number>":57012.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: Who is the author of the tweet with the most 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: Who is the author of the tweet with the most retweets?
df.columns = ['id<gx:category>', 'author_id<gx:category>', 'author_name<gx:category>', 'author_handler<gx:category>', 'author_avatar<gx:url>', 'user_created_at<gx:date>', 'user_description<gx:text>', 'user_favourites_count<gx:number>', 'user_followers_count<gx:number>', 'user_following_count<gx:number>', 'user_listed_count<gx:number>', 'user_tweets_count<gx:number>', 'user_verified<gx:boolean>', 'user_location<gx:text>', 'lang<gx:category>', 'type<gx:category>', 'text<gx:text>', 'date<gx:date>', 'mention_ids<gx:list[category]>', 'mention_names<gx:list[category]>', 'retweets<gx:number>', 'favorites<gx:number>', 'replies<gx:number>', 'quotes<gx:number>', 'links<gx:list[url]>', 'links_first<gx:url>', 'image_links<gx:list[url]>', 'image_links_first<gx:url>', 'rp_user_id<gx:category>', 'rp_user_name<gx:category>', 'location<gx:text>', 'tweet_link<gx:url>', 'source<gx:text>', 'search<gx:category>']
# Expected output type: is category, this will be checked.
return | 20250129013717 |
92 | Who are the top 3 authors with the most followers? | 054_Joe | dev | list[category] | ['author_name<gx:category>', 'user_followers_count<gx:number>'] | 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<gx:category>",
"type": "int64"
},
{
"name": "author_id<gx:category>",
"type": "uint32"
},
{
"name": "author_name<gx:category>",
"type": "category"
},
{
"name": "author_handler<gx:category>",
"type": "category"
},
{
"name": "author_avatar<gx:url>",
"type": "category"
},
{
"name": "user_created_at<gx:date>",
"type": "datetime64[ns, UTC]"
},
{
"name": "user_description<gx:text>",
"type": "category"
},
{
"name": "user_favourites_count<gx:number>",
"type": "uint8"
},
{
"name": "user_followers_count<gx:number>",
"type": "uint32"
},
{
"name": "user_following_count<gx:number>",
"type": "uint8"
},
{
"name": "user_listed_count<gx:number>",
"type": "uint16"
},
{
"name": "user_tweets_count<gx:number>",
"type": "uint16"
},
{
"name": "user_verified<gx:boolean>",
"type": "bool"
},
{
"name": "user_location<gx:text>",
"type": "category"
},
{
"name": "lang<gx:category>",
"type": "category"
},
{
"name": "type<gx:category>",
"type": "category"
},
{
"name": "text<gx:text>",
"type": "object"
},
{
"name": "date<gx:date>",
"type": "datetime64[ns, UTC]"
},
{
"name": "mention_ids<gx:list[category]>",
"type": "object"
},
{
"name": "mention_names<gx:list[category]>",
"type": "object"
},
{
"name": "retweets<gx:number>",
"type": "uint32"
},
{
"name": "favorites<gx:number>",
"type": "uint32"
},
{
"name": "replies<gx:number>",
"type": "uint16"
},
{
"name": "quotes<gx:number>",
"type": "uint16"
},
{
"name": "links<gx:list[url]>",
"type": "object"
},
{
"name": "links_first<gx:url>",
"type": "category"
},
{
"name": "image_links<gx:list[url]>",
"type": "object"
},
{
"name": "image_links_first<gx:url>",
"type": "category"
},
{
"name": "rp_user_id<gx:category>",
"type": "category"
},
{
"name": "rp_user_name<gx:category>",
"type": "category"
},
{
"name": "location<gx:text>",
"type": "category"
},
{
"name": "tweet_link<gx:url>",
"type": "category"
},
{
"name": "source<gx:text>",
"type": "category"
},
{
"name": "search<gx:category>",
"type": "category"
}
]
}
# Description of dataframe columns.
df_descrption = {
"count":{
"id<gx:category>":491.0,
"author_id<gx:category>":491.0,
"user_favourites_count<gx:number>":491.0,
"user_followers_count<gx:number>":491.0,
"user_following_count<gx:number>":491.0,
"user_listed_count<gx:number>":491.0,
"user_tweets_count<gx:number>":491.0,
"retweets<gx:number>":491.0,
"favorites<gx:number>":491.0,
"replies<gx:number>":491.0,
"quotes<gx:number>":491.0
},
"mean":{
"id<gx:category>":1.230895609e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30218726.7454175167,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0590631365,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":5200.4623217923,
"favorites<gx:number>":41536.8635437882,
"replies<gx:number>":2056.5600814664,
"quotes<gx:number>":754.8859470468
},
"std":{
"id<gx:category>":7.194010391e+16,
"author_id<gx:category>":0.0,
"user_favourites_count<gx:number>":0.0,
"user_followers_count<gx:number>":23210.2101437425,
"user_following_count<gx:number>":0.0,
"user_listed_count<gx:number>":0.2526882771,
"user_tweets_count<gx:number>":0.0,
"retweets<gx:number>":13471.3749539952,
"favorites<gx:number>":99344.577018021,
"replies<gx:number>":3666.4962808525,
"quotes<gx:number>":3078.002195837
},
"min":{
"id<gx:category>":1.100456021e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212691.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36166.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":85.0,
"favorites<gx:number>":393.0,
"replies<gx:number>":22.0,
"quotes<gx:number>":0.0
},
"25%":{
"id<gx:category>":1.16465648e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212703.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":249.0,
"favorites<gx:number>":1245.5,
"replies<gx:number>":156.0,
"quotes<gx:number>":22.0
},
"50%":{
"id<gx:category>":1.229553614e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212708.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":1218.0,
"favorites<gx:number>":5730.0,
"replies<gx:number>":552.0,
"quotes<gx:number>":90.0
},
"75%":{
"id<gx:category>":1.296563283e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212712.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":4589.5,
"favorites<gx:number>":28466.5,
"replies<gx:number>":2210.0,
"quotes<gx:number>":444.0
},
"max":{
"id<gx:category>":1.391422726e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30308047.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36168.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":205169.0,
"favorites<gx:number>":889245.0,
"replies<gx:number>":29351.0,
"quotes<gx:number>":57012.0
}
}
# Randome sample of 10 rows from the dataframe.
df_random_sample = {
"count":{
"id<gx:category>":491.0,
"author_id<gx:category>":491.0,
"user_favourites_count<gx:number>":491.0,
"user_followers_count<gx:number>":491.0,
"user_following_count<gx:number>":491.0,
"user_listed_count<gx:number>":491.0,
"user_tweets_count<gx:number>":491.0,
"retweets<gx:number>":491.0,
"favorites<gx:number>":491.0,
"replies<gx:number>":491.0,
"quotes<gx:number>":491.0
},
"mean":{
"id<gx:category>":1.230895609e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30218726.7454175167,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0590631365,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":5200.4623217923,
"favorites<gx:number>":41536.8635437882,
"replies<gx:number>":2056.5600814664,
"quotes<gx:number>":754.8859470468
},
"std":{
"id<gx:category>":7.194010391e+16,
"author_id<gx:category>":0.0,
"user_favourites_count<gx:number>":0.0,
"user_followers_count<gx:number>":23210.2101437425,
"user_following_count<gx:number>":0.0,
"user_listed_count<gx:number>":0.2526882771,
"user_tweets_count<gx:number>":0.0,
"retweets<gx:number>":13471.3749539952,
"favorites<gx:number>":99344.577018021,
"replies<gx:number>":3666.4962808525,
"quotes<gx:number>":3078.002195837
},
"min":{
"id<gx:category>":1.100456021e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212691.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36166.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":85.0,
"favorites<gx:number>":393.0,
"replies<gx:number>":22.0,
"quotes<gx:number>":0.0
},
"25%":{
"id<gx:category>":1.16465648e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212703.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":249.0,
"favorites<gx:number>":1245.5,
"replies<gx:number>":156.0,
"quotes<gx:number>":22.0
},
"50%":{
"id<gx:category>":1.229553614e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212708.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":1218.0,
"favorites<gx:number>":5730.0,
"replies<gx:number>":552.0,
"quotes<gx:number>":90.0
},
"75%":{
"id<gx:category>":1.296563283e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212712.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":4589.5,
"favorites<gx:number>":28466.5,
"replies<gx:number>":2210.0,
"quotes<gx:number>":444.0
},
"max":{
"id<gx:category>":1.391422726e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30308047.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36168.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":205169.0,
"favorites<gx:number>":889245.0,
"replies<gx:number>":29351.0,
"quotes<gx:number>":57012.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: Who are the top 3 authors with the most followers?
# The answer should only contain python code, you are not allowed leave any TODO undone.
def answer(df: pd.DataFrame):
# Use df to answer: Who are the top 3 authors with the most followers?
df.columns = ['id<gx:category>', 'author_id<gx:category>', 'author_name<gx:category>', 'author_handler<gx:category>', 'author_avatar<gx:url>', 'user_created_at<gx:date>', 'user_description<gx:text>', 'user_favourites_count<gx:number>', 'user_followers_count<gx:number>', 'user_following_count<gx:number>', 'user_listed_count<gx:number>', 'user_tweets_count<gx:number>', 'user_verified<gx:boolean>', 'user_location<gx:text>', 'lang<gx:category>', 'type<gx:category>', 'text<gx:text>', 'date<gx:date>', 'mention_ids<gx:list[category]>', 'mention_names<gx:list[category]>', 'retweets<gx:number>', 'favorites<gx:number>', 'replies<gx:number>', 'quotes<gx:number>', 'links<gx:list[url]>', 'links_first<gx:url>', 'image_links<gx:list[url]>', 'image_links_first<gx:url>', 'rp_user_id<gx:category>', 'rp_user_name<gx:category>', 'location<gx:text>', 'tweet_link<gx:url>', 'source<gx:text>', 'search<gx:category>']
# Expected output type: is list[category], this will be checked.
return | 20250129013717 |
93 | Who are the top 4 authors with the most favourites? | 054_Joe | dev | list[category] | ['author_name<gx:category>', 'user_favourites_count<gx:number>'] | 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<gx:category>",
"type": "int64"
},
{
"name": "author_id<gx:category>",
"type": "uint32"
},
{
"name": "author_name<gx:category>",
"type": "category"
},
{
"name": "author_handler<gx:category>",
"type": "category"
},
{
"name": "author_avatar<gx:url>",
"type": "category"
},
{
"name": "user_created_at<gx:date>",
"type": "datetime64[ns, UTC]"
},
{
"name": "user_description<gx:text>",
"type": "category"
},
{
"name": "user_favourites_count<gx:number>",
"type": "uint8"
},
{
"name": "user_followers_count<gx:number>",
"type": "uint32"
},
{
"name": "user_following_count<gx:number>",
"type": "uint8"
},
{
"name": "user_listed_count<gx:number>",
"type": "uint16"
},
{
"name": "user_tweets_count<gx:number>",
"type": "uint16"
},
{
"name": "user_verified<gx:boolean>",
"type": "bool"
},
{
"name": "user_location<gx:text>",
"type": "category"
},
{
"name": "lang<gx:category>",
"type": "category"
},
{
"name": "type<gx:category>",
"type": "category"
},
{
"name": "text<gx:text>",
"type": "object"
},
{
"name": "date<gx:date>",
"type": "datetime64[ns, UTC]"
},
{
"name": "mention_ids<gx:list[category]>",
"type": "object"
},
{
"name": "mention_names<gx:list[category]>",
"type": "object"
},
{
"name": "retweets<gx:number>",
"type": "uint32"
},
{
"name": "favorites<gx:number>",
"type": "uint32"
},
{
"name": "replies<gx:number>",
"type": "uint16"
},
{
"name": "quotes<gx:number>",
"type": "uint16"
},
{
"name": "links<gx:list[url]>",
"type": "object"
},
{
"name": "links_first<gx:url>",
"type": "category"
},
{
"name": "image_links<gx:list[url]>",
"type": "object"
},
{
"name": "image_links_first<gx:url>",
"type": "category"
},
{
"name": "rp_user_id<gx:category>",
"type": "category"
},
{
"name": "rp_user_name<gx:category>",
"type": "category"
},
{
"name": "location<gx:text>",
"type": "category"
},
{
"name": "tweet_link<gx:url>",
"type": "category"
},
{
"name": "source<gx:text>",
"type": "category"
},
{
"name": "search<gx:category>",
"type": "category"
}
]
}
# Description of dataframe columns.
df_descrption = {
"count":{
"id<gx:category>":491.0,
"author_id<gx:category>":491.0,
"user_favourites_count<gx:number>":491.0,
"user_followers_count<gx:number>":491.0,
"user_following_count<gx:number>":491.0,
"user_listed_count<gx:number>":491.0,
"user_tweets_count<gx:number>":491.0,
"retweets<gx:number>":491.0,
"favorites<gx:number>":491.0,
"replies<gx:number>":491.0,
"quotes<gx:number>":491.0
},
"mean":{
"id<gx:category>":1.230895609e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30218726.7454175167,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0590631365,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":5200.4623217923,
"favorites<gx:number>":41536.8635437882,
"replies<gx:number>":2056.5600814664,
"quotes<gx:number>":754.8859470468
},
"std":{
"id<gx:category>":7.194010391e+16,
"author_id<gx:category>":0.0,
"user_favourites_count<gx:number>":0.0,
"user_followers_count<gx:number>":23210.2101437425,
"user_following_count<gx:number>":0.0,
"user_listed_count<gx:number>":0.2526882771,
"user_tweets_count<gx:number>":0.0,
"retweets<gx:number>":13471.3749539952,
"favorites<gx:number>":99344.577018021,
"replies<gx:number>":3666.4962808525,
"quotes<gx:number>":3078.002195837
},
"min":{
"id<gx:category>":1.100456021e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212691.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36166.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":85.0,
"favorites<gx:number>":393.0,
"replies<gx:number>":22.0,
"quotes<gx:number>":0.0
},
"25%":{
"id<gx:category>":1.16465648e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212703.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":249.0,
"favorites<gx:number>":1245.5,
"replies<gx:number>":156.0,
"quotes<gx:number>":22.0
},
"50%":{
"id<gx:category>":1.229553614e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212708.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":1218.0,
"favorites<gx:number>":5730.0,
"replies<gx:number>":552.0,
"quotes<gx:number>":90.0
},
"75%":{
"id<gx:category>":1.296563283e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212712.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":4589.5,
"favorites<gx:number>":28466.5,
"replies<gx:number>":2210.0,
"quotes<gx:number>":444.0
},
"max":{
"id<gx:category>":1.391422726e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30308047.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36168.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":205169.0,
"favorites<gx:number>":889245.0,
"replies<gx:number>":29351.0,
"quotes<gx:number>":57012.0
}
}
# Randome sample of 10 rows from the dataframe.
df_random_sample = {
"count":{
"id<gx:category>":491.0,
"author_id<gx:category>":491.0,
"user_favourites_count<gx:number>":491.0,
"user_followers_count<gx:number>":491.0,
"user_following_count<gx:number>":491.0,
"user_listed_count<gx:number>":491.0,
"user_tweets_count<gx:number>":491.0,
"retweets<gx:number>":491.0,
"favorites<gx:number>":491.0,
"replies<gx:number>":491.0,
"quotes<gx:number>":491.0
},
"mean":{
"id<gx:category>":1.230895609e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30218726.7454175167,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0590631365,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":5200.4623217923,
"favorites<gx:number>":41536.8635437882,
"replies<gx:number>":2056.5600814664,
"quotes<gx:number>":754.8859470468
},
"std":{
"id<gx:category>":7.194010391e+16,
"author_id<gx:category>":0.0,
"user_favourites_count<gx:number>":0.0,
"user_followers_count<gx:number>":23210.2101437425,
"user_following_count<gx:number>":0.0,
"user_listed_count<gx:number>":0.2526882771,
"user_tweets_count<gx:number>":0.0,
"retweets<gx:number>":13471.3749539952,
"favorites<gx:number>":99344.577018021,
"replies<gx:number>":3666.4962808525,
"quotes<gx:number>":3078.002195837
},
"min":{
"id<gx:category>":1.100456021e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212691.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36166.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":85.0,
"favorites<gx:number>":393.0,
"replies<gx:number>":22.0,
"quotes<gx:number>":0.0
},
"25%":{
"id<gx:category>":1.16465648e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212703.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":249.0,
"favorites<gx:number>":1245.5,
"replies<gx:number>":156.0,
"quotes<gx:number>":22.0
},
"50%":{
"id<gx:category>":1.229553614e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212708.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":1218.0,
"favorites<gx:number>":5730.0,
"replies<gx:number>":552.0,
"quotes<gx:number>":90.0
},
"75%":{
"id<gx:category>":1.296563283e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212712.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":4589.5,
"favorites<gx:number>":28466.5,
"replies<gx:number>":2210.0,
"quotes<gx:number>":444.0
},
"max":{
"id<gx:category>":1.391422726e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30308047.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36168.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":205169.0,
"favorites<gx:number>":889245.0,
"replies<gx:number>":29351.0,
"quotes<gx:number>":57012.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: Who are the top 4 authors with the most favourites?
# The answer should only contain python code, you are not allowed leave any TODO undone.
def answer(df: pd.DataFrame):
# Use df to answer: Who are the top 4 authors with the most favourites?
df.columns = ['id<gx:category>', 'author_id<gx:category>', 'author_name<gx:category>', 'author_handler<gx:category>', 'author_avatar<gx:url>', 'user_created_at<gx:date>', 'user_description<gx:text>', 'user_favourites_count<gx:number>', 'user_followers_count<gx:number>', 'user_following_count<gx:number>', 'user_listed_count<gx:number>', 'user_tweets_count<gx:number>', 'user_verified<gx:boolean>', 'user_location<gx:text>', 'lang<gx:category>', 'type<gx:category>', 'text<gx:text>', 'date<gx:date>', 'mention_ids<gx:list[category]>', 'mention_names<gx:list[category]>', 'retweets<gx:number>', 'favorites<gx:number>', 'replies<gx:number>', 'quotes<gx:number>', 'links<gx:list[url]>', 'links_first<gx:url>', 'image_links<gx:list[url]>', 'image_links_first<gx:url>', 'rp_user_id<gx:category>', 'rp_user_name<gx:category>', 'location<gx:text>', 'tweet_link<gx:url>', 'source<gx:text>', 'search<gx:category>']
# Expected output type: is list[category], this will be checked.
return | 20250129013717 |
94 | Who are the 4 users by name apart from the author who are mentioned the most often? | 054_Joe | dev | list[category] | ['author_name<gx:category>', 'mention_names<gx:list[category]>'] | 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<gx:category>",
"type": "int64"
},
{
"name": "author_id<gx:category>",
"type": "uint32"
},
{
"name": "author_name<gx:category>",
"type": "category"
},
{
"name": "author_handler<gx:category>",
"type": "category"
},
{
"name": "author_avatar<gx:url>",
"type": "category"
},
{
"name": "user_created_at<gx:date>",
"type": "datetime64[ns, UTC]"
},
{
"name": "user_description<gx:text>",
"type": "category"
},
{
"name": "user_favourites_count<gx:number>",
"type": "uint8"
},
{
"name": "user_followers_count<gx:number>",
"type": "uint32"
},
{
"name": "user_following_count<gx:number>",
"type": "uint8"
},
{
"name": "user_listed_count<gx:number>",
"type": "uint16"
},
{
"name": "user_tweets_count<gx:number>",
"type": "uint16"
},
{
"name": "user_verified<gx:boolean>",
"type": "bool"
},
{
"name": "user_location<gx:text>",
"type": "category"
},
{
"name": "lang<gx:category>",
"type": "category"
},
{
"name": "type<gx:category>",
"type": "category"
},
{
"name": "text<gx:text>",
"type": "object"
},
{
"name": "date<gx:date>",
"type": "datetime64[ns, UTC]"
},
{
"name": "mention_ids<gx:list[category]>",
"type": "object"
},
{
"name": "mention_names<gx:list[category]>",
"type": "object"
},
{
"name": "retweets<gx:number>",
"type": "uint32"
},
{
"name": "favorites<gx:number>",
"type": "uint32"
},
{
"name": "replies<gx:number>",
"type": "uint16"
},
{
"name": "quotes<gx:number>",
"type": "uint16"
},
{
"name": "links<gx:list[url]>",
"type": "object"
},
{
"name": "links_first<gx:url>",
"type": "category"
},
{
"name": "image_links<gx:list[url]>",
"type": "object"
},
{
"name": "image_links_first<gx:url>",
"type": "category"
},
{
"name": "rp_user_id<gx:category>",
"type": "category"
},
{
"name": "rp_user_name<gx:category>",
"type": "category"
},
{
"name": "location<gx:text>",
"type": "category"
},
{
"name": "tweet_link<gx:url>",
"type": "category"
},
{
"name": "source<gx:text>",
"type": "category"
},
{
"name": "search<gx:category>",
"type": "category"
}
]
}
# Description of dataframe columns.
df_descrption = {
"count":{
"id<gx:category>":491.0,
"author_id<gx:category>":491.0,
"user_favourites_count<gx:number>":491.0,
"user_followers_count<gx:number>":491.0,
"user_following_count<gx:number>":491.0,
"user_listed_count<gx:number>":491.0,
"user_tweets_count<gx:number>":491.0,
"retweets<gx:number>":491.0,
"favorites<gx:number>":491.0,
"replies<gx:number>":491.0,
"quotes<gx:number>":491.0
},
"mean":{
"id<gx:category>":1.230895609e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30218726.7454175167,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0590631365,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":5200.4623217923,
"favorites<gx:number>":41536.8635437882,
"replies<gx:number>":2056.5600814664,
"quotes<gx:number>":754.8859470468
},
"std":{
"id<gx:category>":7.194010391e+16,
"author_id<gx:category>":0.0,
"user_favourites_count<gx:number>":0.0,
"user_followers_count<gx:number>":23210.2101437425,
"user_following_count<gx:number>":0.0,
"user_listed_count<gx:number>":0.2526882771,
"user_tweets_count<gx:number>":0.0,
"retweets<gx:number>":13471.3749539952,
"favorites<gx:number>":99344.577018021,
"replies<gx:number>":3666.4962808525,
"quotes<gx:number>":3078.002195837
},
"min":{
"id<gx:category>":1.100456021e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212691.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36166.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":85.0,
"favorites<gx:number>":393.0,
"replies<gx:number>":22.0,
"quotes<gx:number>":0.0
},
"25%":{
"id<gx:category>":1.16465648e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212703.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":249.0,
"favorites<gx:number>":1245.5,
"replies<gx:number>":156.0,
"quotes<gx:number>":22.0
},
"50%":{
"id<gx:category>":1.229553614e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212708.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":1218.0,
"favorites<gx:number>":5730.0,
"replies<gx:number>":552.0,
"quotes<gx:number>":90.0
},
"75%":{
"id<gx:category>":1.296563283e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212712.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":4589.5,
"favorites<gx:number>":28466.5,
"replies<gx:number>":2210.0,
"quotes<gx:number>":444.0
},
"max":{
"id<gx:category>":1.391422726e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30308047.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36168.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":205169.0,
"favorites<gx:number>":889245.0,
"replies<gx:number>":29351.0,
"quotes<gx:number>":57012.0
}
}
# Randome sample of 10 rows from the dataframe.
df_random_sample = {
"count":{
"id<gx:category>":491.0,
"author_id<gx:category>":491.0,
"user_favourites_count<gx:number>":491.0,
"user_followers_count<gx:number>":491.0,
"user_following_count<gx:number>":491.0,
"user_listed_count<gx:number>":491.0,
"user_tweets_count<gx:number>":491.0,
"retweets<gx:number>":491.0,
"favorites<gx:number>":491.0,
"replies<gx:number>":491.0,
"quotes<gx:number>":491.0
},
"mean":{
"id<gx:category>":1.230895609e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30218726.7454175167,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0590631365,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":5200.4623217923,
"favorites<gx:number>":41536.8635437882,
"replies<gx:number>":2056.5600814664,
"quotes<gx:number>":754.8859470468
},
"std":{
"id<gx:category>":7.194010391e+16,
"author_id<gx:category>":0.0,
"user_favourites_count<gx:number>":0.0,
"user_followers_count<gx:number>":23210.2101437425,
"user_following_count<gx:number>":0.0,
"user_listed_count<gx:number>":0.2526882771,
"user_tweets_count<gx:number>":0.0,
"retweets<gx:number>":13471.3749539952,
"favorites<gx:number>":99344.577018021,
"replies<gx:number>":3666.4962808525,
"quotes<gx:number>":3078.002195837
},
"min":{
"id<gx:category>":1.100456021e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212691.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36166.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":85.0,
"favorites<gx:number>":393.0,
"replies<gx:number>":22.0,
"quotes<gx:number>":0.0
},
"25%":{
"id<gx:category>":1.16465648e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212703.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":249.0,
"favorites<gx:number>":1245.5,
"replies<gx:number>":156.0,
"quotes<gx:number>":22.0
},
"50%":{
"id<gx:category>":1.229553614e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212708.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":1218.0,
"favorites<gx:number>":5730.0,
"replies<gx:number>":552.0,
"quotes<gx:number>":90.0
},
"75%":{
"id<gx:category>":1.296563283e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212712.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":4589.5,
"favorites<gx:number>":28466.5,
"replies<gx:number>":2210.0,
"quotes<gx:number>":444.0
},
"max":{
"id<gx:category>":1.391422726e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30308047.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36168.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":205169.0,
"favorites<gx:number>":889245.0,
"replies<gx:number>":29351.0,
"quotes<gx:number>":57012.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: Who are the 4 users by name apart from the author who are mentioned the most often?
# The answer should only contain python code, you are not allowed leave any TODO undone.
def answer(df: pd.DataFrame):
# Use df to answer: Who are the 4 users by name apart from the author who are mentioned the most often?
df.columns = ['id<gx:category>', 'author_id<gx:category>', 'author_name<gx:category>', 'author_handler<gx:category>', 'author_avatar<gx:url>', 'user_created_at<gx:date>', 'user_description<gx:text>', 'user_favourites_count<gx:number>', 'user_followers_count<gx:number>', 'user_following_count<gx:number>', 'user_listed_count<gx:number>', 'user_tweets_count<gx:number>', 'user_verified<gx:boolean>', 'user_location<gx:text>', 'lang<gx:category>', 'type<gx:category>', 'text<gx:text>', 'date<gx:date>', 'mention_ids<gx:list[category]>', 'mention_names<gx:list[category]>', 'retweets<gx:number>', 'favorites<gx:number>', 'replies<gx:number>', 'quotes<gx:number>', 'links<gx:list[url]>', 'links_first<gx:url>', 'image_links<gx:list[url]>', 'image_links_first<gx:url>', 'rp_user_id<gx:category>', 'rp_user_name<gx:category>', 'location<gx:text>', 'tweet_link<gx:url>', 'source<gx:text>', 'search<gx:category>']
# Expected output type: is list[category], this will be checked.
return | 20250129013717 |
95 | Who are the top 2 authors of the tweets with the most retweets? | 054_Joe | dev | list[category] | ['author_name<gx:category>', 'retweets<gx:number>'] | 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<gx:category>",
"type": "int64"
},
{
"name": "author_id<gx:category>",
"type": "uint32"
},
{
"name": "author_name<gx:category>",
"type": "category"
},
{
"name": "author_handler<gx:category>",
"type": "category"
},
{
"name": "author_avatar<gx:url>",
"type": "category"
},
{
"name": "user_created_at<gx:date>",
"type": "datetime64[ns, UTC]"
},
{
"name": "user_description<gx:text>",
"type": "category"
},
{
"name": "user_favourites_count<gx:number>",
"type": "uint8"
},
{
"name": "user_followers_count<gx:number>",
"type": "uint32"
},
{
"name": "user_following_count<gx:number>",
"type": "uint8"
},
{
"name": "user_listed_count<gx:number>",
"type": "uint16"
},
{
"name": "user_tweets_count<gx:number>",
"type": "uint16"
},
{
"name": "user_verified<gx:boolean>",
"type": "bool"
},
{
"name": "user_location<gx:text>",
"type": "category"
},
{
"name": "lang<gx:category>",
"type": "category"
},
{
"name": "type<gx:category>",
"type": "category"
},
{
"name": "text<gx:text>",
"type": "object"
},
{
"name": "date<gx:date>",
"type": "datetime64[ns, UTC]"
},
{
"name": "mention_ids<gx:list[category]>",
"type": "object"
},
{
"name": "mention_names<gx:list[category]>",
"type": "object"
},
{
"name": "retweets<gx:number>",
"type": "uint32"
},
{
"name": "favorites<gx:number>",
"type": "uint32"
},
{
"name": "replies<gx:number>",
"type": "uint16"
},
{
"name": "quotes<gx:number>",
"type": "uint16"
},
{
"name": "links<gx:list[url]>",
"type": "object"
},
{
"name": "links_first<gx:url>",
"type": "category"
},
{
"name": "image_links<gx:list[url]>",
"type": "object"
},
{
"name": "image_links_first<gx:url>",
"type": "category"
},
{
"name": "rp_user_id<gx:category>",
"type": "category"
},
{
"name": "rp_user_name<gx:category>",
"type": "category"
},
{
"name": "location<gx:text>",
"type": "category"
},
{
"name": "tweet_link<gx:url>",
"type": "category"
},
{
"name": "source<gx:text>",
"type": "category"
},
{
"name": "search<gx:category>",
"type": "category"
}
]
}
# Description of dataframe columns.
df_descrption = {
"count":{
"id<gx:category>":491.0,
"author_id<gx:category>":491.0,
"user_favourites_count<gx:number>":491.0,
"user_followers_count<gx:number>":491.0,
"user_following_count<gx:number>":491.0,
"user_listed_count<gx:number>":491.0,
"user_tweets_count<gx:number>":491.0,
"retweets<gx:number>":491.0,
"favorites<gx:number>":491.0,
"replies<gx:number>":491.0,
"quotes<gx:number>":491.0
},
"mean":{
"id<gx:category>":1.230895609e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30218726.7454175167,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0590631365,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":5200.4623217923,
"favorites<gx:number>":41536.8635437882,
"replies<gx:number>":2056.5600814664,
"quotes<gx:number>":754.8859470468
},
"std":{
"id<gx:category>":7.194010391e+16,
"author_id<gx:category>":0.0,
"user_favourites_count<gx:number>":0.0,
"user_followers_count<gx:number>":23210.2101437425,
"user_following_count<gx:number>":0.0,
"user_listed_count<gx:number>":0.2526882771,
"user_tweets_count<gx:number>":0.0,
"retweets<gx:number>":13471.3749539952,
"favorites<gx:number>":99344.577018021,
"replies<gx:number>":3666.4962808525,
"quotes<gx:number>":3078.002195837
},
"min":{
"id<gx:category>":1.100456021e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212691.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36166.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":85.0,
"favorites<gx:number>":393.0,
"replies<gx:number>":22.0,
"quotes<gx:number>":0.0
},
"25%":{
"id<gx:category>":1.16465648e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212703.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":249.0,
"favorites<gx:number>":1245.5,
"replies<gx:number>":156.0,
"quotes<gx:number>":22.0
},
"50%":{
"id<gx:category>":1.229553614e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212708.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":1218.0,
"favorites<gx:number>":5730.0,
"replies<gx:number>":552.0,
"quotes<gx:number>":90.0
},
"75%":{
"id<gx:category>":1.296563283e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212712.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":4589.5,
"favorites<gx:number>":28466.5,
"replies<gx:number>":2210.0,
"quotes<gx:number>":444.0
},
"max":{
"id<gx:category>":1.391422726e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30308047.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36168.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":205169.0,
"favorites<gx:number>":889245.0,
"replies<gx:number>":29351.0,
"quotes<gx:number>":57012.0
}
}
# Randome sample of 10 rows from the dataframe.
df_random_sample = {
"count":{
"id<gx:category>":491.0,
"author_id<gx:category>":491.0,
"user_favourites_count<gx:number>":491.0,
"user_followers_count<gx:number>":491.0,
"user_following_count<gx:number>":491.0,
"user_listed_count<gx:number>":491.0,
"user_tweets_count<gx:number>":491.0,
"retweets<gx:number>":491.0,
"favorites<gx:number>":491.0,
"replies<gx:number>":491.0,
"quotes<gx:number>":491.0
},
"mean":{
"id<gx:category>":1.230895609e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30218726.7454175167,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0590631365,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":5200.4623217923,
"favorites<gx:number>":41536.8635437882,
"replies<gx:number>":2056.5600814664,
"quotes<gx:number>":754.8859470468
},
"std":{
"id<gx:category>":7.194010391e+16,
"author_id<gx:category>":0.0,
"user_favourites_count<gx:number>":0.0,
"user_followers_count<gx:number>":23210.2101437425,
"user_following_count<gx:number>":0.0,
"user_listed_count<gx:number>":0.2526882771,
"user_tweets_count<gx:number>":0.0,
"retweets<gx:number>":13471.3749539952,
"favorites<gx:number>":99344.577018021,
"replies<gx:number>":3666.4962808525,
"quotes<gx:number>":3078.002195837
},
"min":{
"id<gx:category>":1.100456021e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212691.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36166.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":85.0,
"favorites<gx:number>":393.0,
"replies<gx:number>":22.0,
"quotes<gx:number>":0.0
},
"25%":{
"id<gx:category>":1.16465648e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212703.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":249.0,
"favorites<gx:number>":1245.5,
"replies<gx:number>":156.0,
"quotes<gx:number>":22.0
},
"50%":{
"id<gx:category>":1.229553614e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212708.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":1218.0,
"favorites<gx:number>":5730.0,
"replies<gx:number>":552.0,
"quotes<gx:number>":90.0
},
"75%":{
"id<gx:category>":1.296563283e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212712.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":4589.5,
"favorites<gx:number>":28466.5,
"replies<gx:number>":2210.0,
"quotes<gx:number>":444.0
},
"max":{
"id<gx:category>":1.391422726e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30308047.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36168.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":205169.0,
"favorites<gx:number>":889245.0,
"replies<gx:number>":29351.0,
"quotes<gx:number>":57012.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: Who are the top 2 authors of the tweets with the most 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: Who are the top 2 authors of the tweets with the most retweets?
df.columns = ['id<gx:category>', 'author_id<gx:category>', 'author_name<gx:category>', 'author_handler<gx:category>', 'author_avatar<gx:url>', 'user_created_at<gx:date>', 'user_description<gx:text>', 'user_favourites_count<gx:number>', 'user_followers_count<gx:number>', 'user_following_count<gx:number>', 'user_listed_count<gx:number>', 'user_tweets_count<gx:number>', 'user_verified<gx:boolean>', 'user_location<gx:text>', 'lang<gx:category>', 'type<gx:category>', 'text<gx:text>', 'date<gx:date>', 'mention_ids<gx:list[category]>', 'mention_names<gx:list[category]>', 'retweets<gx:number>', 'favorites<gx:number>', 'replies<gx:number>', 'quotes<gx:number>', 'links<gx:list[url]>', 'links_first<gx:url>', 'image_links<gx:list[url]>', 'image_links_first<gx:url>', 'rp_user_id<gx:category>', 'rp_user_name<gx:category>', 'location<gx:text>', 'tweet_link<gx:url>', 'source<gx:text>', 'search<gx:category>']
# Expected output type: is list[category], this will be checked.
return | 20250129013717 |
96 | What are the top 3 numbers of followers in the dataset? | 054_Joe | dev | list[number] | ['user_followers_count<gx:number>'] | 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<gx:category>",
"type": "int64"
},
{
"name": "author_id<gx:category>",
"type": "uint32"
},
{
"name": "author_name<gx:category>",
"type": "category"
},
{
"name": "author_handler<gx:category>",
"type": "category"
},
{
"name": "author_avatar<gx:url>",
"type": "category"
},
{
"name": "user_created_at<gx:date>",
"type": "datetime64[ns, UTC]"
},
{
"name": "user_description<gx:text>",
"type": "category"
},
{
"name": "user_favourites_count<gx:number>",
"type": "uint8"
},
{
"name": "user_followers_count<gx:number>",
"type": "uint32"
},
{
"name": "user_following_count<gx:number>",
"type": "uint8"
},
{
"name": "user_listed_count<gx:number>",
"type": "uint16"
},
{
"name": "user_tweets_count<gx:number>",
"type": "uint16"
},
{
"name": "user_verified<gx:boolean>",
"type": "bool"
},
{
"name": "user_location<gx:text>",
"type": "category"
},
{
"name": "lang<gx:category>",
"type": "category"
},
{
"name": "type<gx:category>",
"type": "category"
},
{
"name": "text<gx:text>",
"type": "object"
},
{
"name": "date<gx:date>",
"type": "datetime64[ns, UTC]"
},
{
"name": "mention_ids<gx:list[category]>",
"type": "object"
},
{
"name": "mention_names<gx:list[category]>",
"type": "object"
},
{
"name": "retweets<gx:number>",
"type": "uint32"
},
{
"name": "favorites<gx:number>",
"type": "uint32"
},
{
"name": "replies<gx:number>",
"type": "uint16"
},
{
"name": "quotes<gx:number>",
"type": "uint16"
},
{
"name": "links<gx:list[url]>",
"type": "object"
},
{
"name": "links_first<gx:url>",
"type": "category"
},
{
"name": "image_links<gx:list[url]>",
"type": "object"
},
{
"name": "image_links_first<gx:url>",
"type": "category"
},
{
"name": "rp_user_id<gx:category>",
"type": "category"
},
{
"name": "rp_user_name<gx:category>",
"type": "category"
},
{
"name": "location<gx:text>",
"type": "category"
},
{
"name": "tweet_link<gx:url>",
"type": "category"
},
{
"name": "source<gx:text>",
"type": "category"
},
{
"name": "search<gx:category>",
"type": "category"
}
]
}
# Description of dataframe columns.
df_descrption = {
"count":{
"id<gx:category>":491.0,
"author_id<gx:category>":491.0,
"user_favourites_count<gx:number>":491.0,
"user_followers_count<gx:number>":491.0,
"user_following_count<gx:number>":491.0,
"user_listed_count<gx:number>":491.0,
"user_tweets_count<gx:number>":491.0,
"retweets<gx:number>":491.0,
"favorites<gx:number>":491.0,
"replies<gx:number>":491.0,
"quotes<gx:number>":491.0
},
"mean":{
"id<gx:category>":1.230895609e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30218726.7454175167,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0590631365,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":5200.4623217923,
"favorites<gx:number>":41536.8635437882,
"replies<gx:number>":2056.5600814664,
"quotes<gx:number>":754.8859470468
},
"std":{
"id<gx:category>":7.194010391e+16,
"author_id<gx:category>":0.0,
"user_favourites_count<gx:number>":0.0,
"user_followers_count<gx:number>":23210.2101437425,
"user_following_count<gx:number>":0.0,
"user_listed_count<gx:number>":0.2526882771,
"user_tweets_count<gx:number>":0.0,
"retweets<gx:number>":13471.3749539952,
"favorites<gx:number>":99344.577018021,
"replies<gx:number>":3666.4962808525,
"quotes<gx:number>":3078.002195837
},
"min":{
"id<gx:category>":1.100456021e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212691.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36166.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":85.0,
"favorites<gx:number>":393.0,
"replies<gx:number>":22.0,
"quotes<gx:number>":0.0
},
"25%":{
"id<gx:category>":1.16465648e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212703.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":249.0,
"favorites<gx:number>":1245.5,
"replies<gx:number>":156.0,
"quotes<gx:number>":22.0
},
"50%":{
"id<gx:category>":1.229553614e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212708.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":1218.0,
"favorites<gx:number>":5730.0,
"replies<gx:number>":552.0,
"quotes<gx:number>":90.0
},
"75%":{
"id<gx:category>":1.296563283e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212712.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":4589.5,
"favorites<gx:number>":28466.5,
"replies<gx:number>":2210.0,
"quotes<gx:number>":444.0
},
"max":{
"id<gx:category>":1.391422726e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30308047.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36168.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":205169.0,
"favorites<gx:number>":889245.0,
"replies<gx:number>":29351.0,
"quotes<gx:number>":57012.0
}
}
# Randome sample of 10 rows from the dataframe.
df_random_sample = {
"count":{
"id<gx:category>":491.0,
"author_id<gx:category>":491.0,
"user_favourites_count<gx:number>":491.0,
"user_followers_count<gx:number>":491.0,
"user_following_count<gx:number>":491.0,
"user_listed_count<gx:number>":491.0,
"user_tweets_count<gx:number>":491.0,
"retweets<gx:number>":491.0,
"favorites<gx:number>":491.0,
"replies<gx:number>":491.0,
"quotes<gx:number>":491.0
},
"mean":{
"id<gx:category>":1.230895609e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30218726.7454175167,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0590631365,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":5200.4623217923,
"favorites<gx:number>":41536.8635437882,
"replies<gx:number>":2056.5600814664,
"quotes<gx:number>":754.8859470468
},
"std":{
"id<gx:category>":7.194010391e+16,
"author_id<gx:category>":0.0,
"user_favourites_count<gx:number>":0.0,
"user_followers_count<gx:number>":23210.2101437425,
"user_following_count<gx:number>":0.0,
"user_listed_count<gx:number>":0.2526882771,
"user_tweets_count<gx:number>":0.0,
"retweets<gx:number>":13471.3749539952,
"favorites<gx:number>":99344.577018021,
"replies<gx:number>":3666.4962808525,
"quotes<gx:number>":3078.002195837
},
"min":{
"id<gx:category>":1.100456021e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212691.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36166.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":85.0,
"favorites<gx:number>":393.0,
"replies<gx:number>":22.0,
"quotes<gx:number>":0.0
},
"25%":{
"id<gx:category>":1.16465648e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212703.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":249.0,
"favorites<gx:number>":1245.5,
"replies<gx:number>":156.0,
"quotes<gx:number>":22.0
},
"50%":{
"id<gx:category>":1.229553614e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212708.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":1218.0,
"favorites<gx:number>":5730.0,
"replies<gx:number>":552.0,
"quotes<gx:number>":90.0
},
"75%":{
"id<gx:category>":1.296563283e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212712.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":4589.5,
"favorites<gx:number>":28466.5,
"replies<gx:number>":2210.0,
"quotes<gx:number>":444.0
},
"max":{
"id<gx:category>":1.391422726e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30308047.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36168.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":205169.0,
"favorites<gx:number>":889245.0,
"replies<gx:number>":29351.0,
"quotes<gx:number>":57012.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 numbers of followers 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: What are the top 3 numbers of followers in the dataset?
df.columns = ['id<gx:category>', 'author_id<gx:category>', 'author_name<gx:category>', 'author_handler<gx:category>', 'author_avatar<gx:url>', 'user_created_at<gx:date>', 'user_description<gx:text>', 'user_favourites_count<gx:number>', 'user_followers_count<gx:number>', 'user_following_count<gx:number>', 'user_listed_count<gx:number>', 'user_tweets_count<gx:number>', 'user_verified<gx:boolean>', 'user_location<gx:text>', 'lang<gx:category>', 'type<gx:category>', 'text<gx:text>', 'date<gx:date>', 'mention_ids<gx:list[category]>', 'mention_names<gx:list[category]>', 'retweets<gx:number>', 'favorites<gx:number>', 'replies<gx:number>', 'quotes<gx:number>', 'links<gx:list[url]>', 'links_first<gx:url>', 'image_links<gx:list[url]>', 'image_links_first<gx:url>', 'rp_user_id<gx:category>', 'rp_user_name<gx:category>', 'location<gx:text>', 'tweet_link<gx:url>', 'source<gx:text>', 'search<gx:category>']
# Expected output type: is list[number], this will be checked.
return | 20250129013717 |
97 | What are the top 3 numbers of favourites a tweet in the dataset has? | 054_Joe | dev | list[number] | ['favorites<gx:number>'] | 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<gx:category>",
"type": "int64"
},
{
"name": "author_id<gx:category>",
"type": "uint32"
},
{
"name": "author_name<gx:category>",
"type": "category"
},
{
"name": "author_handler<gx:category>",
"type": "category"
},
{
"name": "author_avatar<gx:url>",
"type": "category"
},
{
"name": "user_created_at<gx:date>",
"type": "datetime64[ns, UTC]"
},
{
"name": "user_description<gx:text>",
"type": "category"
},
{
"name": "user_favourites_count<gx:number>",
"type": "uint8"
},
{
"name": "user_followers_count<gx:number>",
"type": "uint32"
},
{
"name": "user_following_count<gx:number>",
"type": "uint8"
},
{
"name": "user_listed_count<gx:number>",
"type": "uint16"
},
{
"name": "user_tweets_count<gx:number>",
"type": "uint16"
},
{
"name": "user_verified<gx:boolean>",
"type": "bool"
},
{
"name": "user_location<gx:text>",
"type": "category"
},
{
"name": "lang<gx:category>",
"type": "category"
},
{
"name": "type<gx:category>",
"type": "category"
},
{
"name": "text<gx:text>",
"type": "object"
},
{
"name": "date<gx:date>",
"type": "datetime64[ns, UTC]"
},
{
"name": "mention_ids<gx:list[category]>",
"type": "object"
},
{
"name": "mention_names<gx:list[category]>",
"type": "object"
},
{
"name": "retweets<gx:number>",
"type": "uint32"
},
{
"name": "favorites<gx:number>",
"type": "uint32"
},
{
"name": "replies<gx:number>",
"type": "uint16"
},
{
"name": "quotes<gx:number>",
"type": "uint16"
},
{
"name": "links<gx:list[url]>",
"type": "object"
},
{
"name": "links_first<gx:url>",
"type": "category"
},
{
"name": "image_links<gx:list[url]>",
"type": "object"
},
{
"name": "image_links_first<gx:url>",
"type": "category"
},
{
"name": "rp_user_id<gx:category>",
"type": "category"
},
{
"name": "rp_user_name<gx:category>",
"type": "category"
},
{
"name": "location<gx:text>",
"type": "category"
},
{
"name": "tweet_link<gx:url>",
"type": "category"
},
{
"name": "source<gx:text>",
"type": "category"
},
{
"name": "search<gx:category>",
"type": "category"
}
]
}
# Description of dataframe columns.
df_descrption = {
"count":{
"id<gx:category>":491.0,
"author_id<gx:category>":491.0,
"user_favourites_count<gx:number>":491.0,
"user_followers_count<gx:number>":491.0,
"user_following_count<gx:number>":491.0,
"user_listed_count<gx:number>":491.0,
"user_tweets_count<gx:number>":491.0,
"retweets<gx:number>":491.0,
"favorites<gx:number>":491.0,
"replies<gx:number>":491.0,
"quotes<gx:number>":491.0
},
"mean":{
"id<gx:category>":1.230895609e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30218726.7454175167,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0590631365,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":5200.4623217923,
"favorites<gx:number>":41536.8635437882,
"replies<gx:number>":2056.5600814664,
"quotes<gx:number>":754.8859470468
},
"std":{
"id<gx:category>":7.194010391e+16,
"author_id<gx:category>":0.0,
"user_favourites_count<gx:number>":0.0,
"user_followers_count<gx:number>":23210.2101437425,
"user_following_count<gx:number>":0.0,
"user_listed_count<gx:number>":0.2526882771,
"user_tweets_count<gx:number>":0.0,
"retweets<gx:number>":13471.3749539952,
"favorites<gx:number>":99344.577018021,
"replies<gx:number>":3666.4962808525,
"quotes<gx:number>":3078.002195837
},
"min":{
"id<gx:category>":1.100456021e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212691.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36166.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":85.0,
"favorites<gx:number>":393.0,
"replies<gx:number>":22.0,
"quotes<gx:number>":0.0
},
"25%":{
"id<gx:category>":1.16465648e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212703.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":249.0,
"favorites<gx:number>":1245.5,
"replies<gx:number>":156.0,
"quotes<gx:number>":22.0
},
"50%":{
"id<gx:category>":1.229553614e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212708.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":1218.0,
"favorites<gx:number>":5730.0,
"replies<gx:number>":552.0,
"quotes<gx:number>":90.0
},
"75%":{
"id<gx:category>":1.296563283e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212712.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":4589.5,
"favorites<gx:number>":28466.5,
"replies<gx:number>":2210.0,
"quotes<gx:number>":444.0
},
"max":{
"id<gx:category>":1.391422726e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30308047.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36168.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":205169.0,
"favorites<gx:number>":889245.0,
"replies<gx:number>":29351.0,
"quotes<gx:number>":57012.0
}
}
# Randome sample of 10 rows from the dataframe.
df_random_sample = {
"count":{
"id<gx:category>":491.0,
"author_id<gx:category>":491.0,
"user_favourites_count<gx:number>":491.0,
"user_followers_count<gx:number>":491.0,
"user_following_count<gx:number>":491.0,
"user_listed_count<gx:number>":491.0,
"user_tweets_count<gx:number>":491.0,
"retweets<gx:number>":491.0,
"favorites<gx:number>":491.0,
"replies<gx:number>":491.0,
"quotes<gx:number>":491.0
},
"mean":{
"id<gx:category>":1.230895609e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30218726.7454175167,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0590631365,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":5200.4623217923,
"favorites<gx:number>":41536.8635437882,
"replies<gx:number>":2056.5600814664,
"quotes<gx:number>":754.8859470468
},
"std":{
"id<gx:category>":7.194010391e+16,
"author_id<gx:category>":0.0,
"user_favourites_count<gx:number>":0.0,
"user_followers_count<gx:number>":23210.2101437425,
"user_following_count<gx:number>":0.0,
"user_listed_count<gx:number>":0.2526882771,
"user_tweets_count<gx:number>":0.0,
"retweets<gx:number>":13471.3749539952,
"favorites<gx:number>":99344.577018021,
"replies<gx:number>":3666.4962808525,
"quotes<gx:number>":3078.002195837
},
"min":{
"id<gx:category>":1.100456021e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212691.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36166.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":85.0,
"favorites<gx:number>":393.0,
"replies<gx:number>":22.0,
"quotes<gx:number>":0.0
},
"25%":{
"id<gx:category>":1.16465648e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212703.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":249.0,
"favorites<gx:number>":1245.5,
"replies<gx:number>":156.0,
"quotes<gx:number>":22.0
},
"50%":{
"id<gx:category>":1.229553614e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212708.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":1218.0,
"favorites<gx:number>":5730.0,
"replies<gx:number>":552.0,
"quotes<gx:number>":90.0
},
"75%":{
"id<gx:category>":1.296563283e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212712.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":4589.5,
"favorites<gx:number>":28466.5,
"replies<gx:number>":2210.0,
"quotes<gx:number>":444.0
},
"max":{
"id<gx:category>":1.391422726e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30308047.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36168.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":205169.0,
"favorites<gx:number>":889245.0,
"replies<gx:number>":29351.0,
"quotes<gx:number>":57012.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 numbers of favourites a tweet in the dataset 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 are the top 3 numbers of favourites a tweet in the dataset has?
df.columns = ['id<gx:category>', 'author_id<gx:category>', 'author_name<gx:category>', 'author_handler<gx:category>', 'author_avatar<gx:url>', 'user_created_at<gx:date>', 'user_description<gx:text>', 'user_favourites_count<gx:number>', 'user_followers_count<gx:number>', 'user_following_count<gx:number>', 'user_listed_count<gx:number>', 'user_tweets_count<gx:number>', 'user_verified<gx:boolean>', 'user_location<gx:text>', 'lang<gx:category>', 'type<gx:category>', 'text<gx:text>', 'date<gx:date>', 'mention_ids<gx:list[category]>', 'mention_names<gx:list[category]>', 'retweets<gx:number>', 'favorites<gx:number>', 'replies<gx:number>', 'quotes<gx:number>', 'links<gx:list[url]>', 'links_first<gx:url>', 'image_links<gx:list[url]>', 'image_links_first<gx:url>', 'rp_user_id<gx:category>', 'rp_user_name<gx:category>', 'location<gx:text>', 'tweet_link<gx:url>', 'source<gx:text>', 'search<gx:category>']
# Expected output type: is list[number], this will be checked.
return | 20250129013717 |
98 | What are the 5 highest unique number of times a user is mentioned? Exclude empty references. | 054_Joe | dev | list[number] | ['mention_names<gx:list[category]>'] | 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<gx:category>",
"type": "int64"
},
{
"name": "author_id<gx:category>",
"type": "uint32"
},
{
"name": "author_name<gx:category>",
"type": "category"
},
{
"name": "author_handler<gx:category>",
"type": "category"
},
{
"name": "author_avatar<gx:url>",
"type": "category"
},
{
"name": "user_created_at<gx:date>",
"type": "datetime64[ns, UTC]"
},
{
"name": "user_description<gx:text>",
"type": "category"
},
{
"name": "user_favourites_count<gx:number>",
"type": "uint8"
},
{
"name": "user_followers_count<gx:number>",
"type": "uint32"
},
{
"name": "user_following_count<gx:number>",
"type": "uint8"
},
{
"name": "user_listed_count<gx:number>",
"type": "uint16"
},
{
"name": "user_tweets_count<gx:number>",
"type": "uint16"
},
{
"name": "user_verified<gx:boolean>",
"type": "bool"
},
{
"name": "user_location<gx:text>",
"type": "category"
},
{
"name": "lang<gx:category>",
"type": "category"
},
{
"name": "type<gx:category>",
"type": "category"
},
{
"name": "text<gx:text>",
"type": "object"
},
{
"name": "date<gx:date>",
"type": "datetime64[ns, UTC]"
},
{
"name": "mention_ids<gx:list[category]>",
"type": "object"
},
{
"name": "mention_names<gx:list[category]>",
"type": "object"
},
{
"name": "retweets<gx:number>",
"type": "uint32"
},
{
"name": "favorites<gx:number>",
"type": "uint32"
},
{
"name": "replies<gx:number>",
"type": "uint16"
},
{
"name": "quotes<gx:number>",
"type": "uint16"
},
{
"name": "links<gx:list[url]>",
"type": "object"
},
{
"name": "links_first<gx:url>",
"type": "category"
},
{
"name": "image_links<gx:list[url]>",
"type": "object"
},
{
"name": "image_links_first<gx:url>",
"type": "category"
},
{
"name": "rp_user_id<gx:category>",
"type": "category"
},
{
"name": "rp_user_name<gx:category>",
"type": "category"
},
{
"name": "location<gx:text>",
"type": "category"
},
{
"name": "tweet_link<gx:url>",
"type": "category"
},
{
"name": "source<gx:text>",
"type": "category"
},
{
"name": "search<gx:category>",
"type": "category"
}
]
}
# Description of dataframe columns.
df_descrption = {
"count":{
"id<gx:category>":491.0,
"author_id<gx:category>":491.0,
"user_favourites_count<gx:number>":491.0,
"user_followers_count<gx:number>":491.0,
"user_following_count<gx:number>":491.0,
"user_listed_count<gx:number>":491.0,
"user_tweets_count<gx:number>":491.0,
"retweets<gx:number>":491.0,
"favorites<gx:number>":491.0,
"replies<gx:number>":491.0,
"quotes<gx:number>":491.0
},
"mean":{
"id<gx:category>":1.230895609e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30218726.7454175167,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0590631365,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":5200.4623217923,
"favorites<gx:number>":41536.8635437882,
"replies<gx:number>":2056.5600814664,
"quotes<gx:number>":754.8859470468
},
"std":{
"id<gx:category>":7.194010391e+16,
"author_id<gx:category>":0.0,
"user_favourites_count<gx:number>":0.0,
"user_followers_count<gx:number>":23210.2101437425,
"user_following_count<gx:number>":0.0,
"user_listed_count<gx:number>":0.2526882771,
"user_tweets_count<gx:number>":0.0,
"retweets<gx:number>":13471.3749539952,
"favorites<gx:number>":99344.577018021,
"replies<gx:number>":3666.4962808525,
"quotes<gx:number>":3078.002195837
},
"min":{
"id<gx:category>":1.100456021e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212691.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36166.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":85.0,
"favorites<gx:number>":393.0,
"replies<gx:number>":22.0,
"quotes<gx:number>":0.0
},
"25%":{
"id<gx:category>":1.16465648e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212703.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":249.0,
"favorites<gx:number>":1245.5,
"replies<gx:number>":156.0,
"quotes<gx:number>":22.0
},
"50%":{
"id<gx:category>":1.229553614e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212708.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":1218.0,
"favorites<gx:number>":5730.0,
"replies<gx:number>":552.0,
"quotes<gx:number>":90.0
},
"75%":{
"id<gx:category>":1.296563283e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212712.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":4589.5,
"favorites<gx:number>":28466.5,
"replies<gx:number>":2210.0,
"quotes<gx:number>":444.0
},
"max":{
"id<gx:category>":1.391422726e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30308047.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36168.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":205169.0,
"favorites<gx:number>":889245.0,
"replies<gx:number>":29351.0,
"quotes<gx:number>":57012.0
}
}
# Randome sample of 10 rows from the dataframe.
df_random_sample = {
"count":{
"id<gx:category>":491.0,
"author_id<gx:category>":491.0,
"user_favourites_count<gx:number>":491.0,
"user_followers_count<gx:number>":491.0,
"user_following_count<gx:number>":491.0,
"user_listed_count<gx:number>":491.0,
"user_tweets_count<gx:number>":491.0,
"retweets<gx:number>":491.0,
"favorites<gx:number>":491.0,
"replies<gx:number>":491.0,
"quotes<gx:number>":491.0
},
"mean":{
"id<gx:category>":1.230895609e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30218726.7454175167,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0590631365,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":5200.4623217923,
"favorites<gx:number>":41536.8635437882,
"replies<gx:number>":2056.5600814664,
"quotes<gx:number>":754.8859470468
},
"std":{
"id<gx:category>":7.194010391e+16,
"author_id<gx:category>":0.0,
"user_favourites_count<gx:number>":0.0,
"user_followers_count<gx:number>":23210.2101437425,
"user_following_count<gx:number>":0.0,
"user_listed_count<gx:number>":0.2526882771,
"user_tweets_count<gx:number>":0.0,
"retweets<gx:number>":13471.3749539952,
"favorites<gx:number>":99344.577018021,
"replies<gx:number>":3666.4962808525,
"quotes<gx:number>":3078.002195837
},
"min":{
"id<gx:category>":1.100456021e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212691.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36166.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":85.0,
"favorites<gx:number>":393.0,
"replies<gx:number>":22.0,
"quotes<gx:number>":0.0
},
"25%":{
"id<gx:category>":1.16465648e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212703.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":249.0,
"favorites<gx:number>":1245.5,
"replies<gx:number>":156.0,
"quotes<gx:number>":22.0
},
"50%":{
"id<gx:category>":1.229553614e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212708.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":1218.0,
"favorites<gx:number>":5730.0,
"replies<gx:number>":552.0,
"quotes<gx:number>":90.0
},
"75%":{
"id<gx:category>":1.296563283e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212712.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":4589.5,
"favorites<gx:number>":28466.5,
"replies<gx:number>":2210.0,
"quotes<gx:number>":444.0
},
"max":{
"id<gx:category>":1.391422726e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30308047.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36168.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":205169.0,
"favorites<gx:number>":889245.0,
"replies<gx:number>":29351.0,
"quotes<gx:number>":57012.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 5 highest unique number of times a user is mentioned? Exclude empty references.
# 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 5 highest unique number of times a user is mentioned? Exclude empty references.
df.columns = ['id<gx:category>', 'author_id<gx:category>', 'author_name<gx:category>', 'author_handler<gx:category>', 'author_avatar<gx:url>', 'user_created_at<gx:date>', 'user_description<gx:text>', 'user_favourites_count<gx:number>', 'user_followers_count<gx:number>', 'user_following_count<gx:number>', 'user_listed_count<gx:number>', 'user_tweets_count<gx:number>', 'user_verified<gx:boolean>', 'user_location<gx:text>', 'lang<gx:category>', 'type<gx:category>', 'text<gx:text>', 'date<gx:date>', 'mention_ids<gx:list[category]>', 'mention_names<gx:list[category]>', 'retweets<gx:number>', 'favorites<gx:number>', 'replies<gx:number>', 'quotes<gx:number>', 'links<gx:list[url]>', 'links_first<gx:url>', 'image_links<gx:list[url]>', 'image_links_first<gx:url>', 'rp_user_id<gx:category>', 'rp_user_name<gx:category>', 'location<gx:text>', 'tweet_link<gx:url>', 'source<gx:text>', 'search<gx:category>']
# Expected output type: is list[number], this will be checked.
return | 20250129013717 |
99 | What are the 2 highest numbers of retweets a tweet in the dataset has? | 054_Joe | dev | list[number] | ['retweets<gx:number>'] | 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<gx:category>",
"type": "int64"
},
{
"name": "author_id<gx:category>",
"type": "uint32"
},
{
"name": "author_name<gx:category>",
"type": "category"
},
{
"name": "author_handler<gx:category>",
"type": "category"
},
{
"name": "author_avatar<gx:url>",
"type": "category"
},
{
"name": "user_created_at<gx:date>",
"type": "datetime64[ns, UTC]"
},
{
"name": "user_description<gx:text>",
"type": "category"
},
{
"name": "user_favourites_count<gx:number>",
"type": "uint8"
},
{
"name": "user_followers_count<gx:number>",
"type": "uint32"
},
{
"name": "user_following_count<gx:number>",
"type": "uint8"
},
{
"name": "user_listed_count<gx:number>",
"type": "uint16"
},
{
"name": "user_tweets_count<gx:number>",
"type": "uint16"
},
{
"name": "user_verified<gx:boolean>",
"type": "bool"
},
{
"name": "user_location<gx:text>",
"type": "category"
},
{
"name": "lang<gx:category>",
"type": "category"
},
{
"name": "type<gx:category>",
"type": "category"
},
{
"name": "text<gx:text>",
"type": "object"
},
{
"name": "date<gx:date>",
"type": "datetime64[ns, UTC]"
},
{
"name": "mention_ids<gx:list[category]>",
"type": "object"
},
{
"name": "mention_names<gx:list[category]>",
"type": "object"
},
{
"name": "retweets<gx:number>",
"type": "uint32"
},
{
"name": "favorites<gx:number>",
"type": "uint32"
},
{
"name": "replies<gx:number>",
"type": "uint16"
},
{
"name": "quotes<gx:number>",
"type": "uint16"
},
{
"name": "links<gx:list[url]>",
"type": "object"
},
{
"name": "links_first<gx:url>",
"type": "category"
},
{
"name": "image_links<gx:list[url]>",
"type": "object"
},
{
"name": "image_links_first<gx:url>",
"type": "category"
},
{
"name": "rp_user_id<gx:category>",
"type": "category"
},
{
"name": "rp_user_name<gx:category>",
"type": "category"
},
{
"name": "location<gx:text>",
"type": "category"
},
{
"name": "tweet_link<gx:url>",
"type": "category"
},
{
"name": "source<gx:text>",
"type": "category"
},
{
"name": "search<gx:category>",
"type": "category"
}
]
}
# Description of dataframe columns.
df_descrption = {
"count":{
"id<gx:category>":491.0,
"author_id<gx:category>":491.0,
"user_favourites_count<gx:number>":491.0,
"user_followers_count<gx:number>":491.0,
"user_following_count<gx:number>":491.0,
"user_listed_count<gx:number>":491.0,
"user_tweets_count<gx:number>":491.0,
"retweets<gx:number>":491.0,
"favorites<gx:number>":491.0,
"replies<gx:number>":491.0,
"quotes<gx:number>":491.0
},
"mean":{
"id<gx:category>":1.230895609e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30218726.7454175167,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0590631365,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":5200.4623217923,
"favorites<gx:number>":41536.8635437882,
"replies<gx:number>":2056.5600814664,
"quotes<gx:number>":754.8859470468
},
"std":{
"id<gx:category>":7.194010391e+16,
"author_id<gx:category>":0.0,
"user_favourites_count<gx:number>":0.0,
"user_followers_count<gx:number>":23210.2101437425,
"user_following_count<gx:number>":0.0,
"user_listed_count<gx:number>":0.2526882771,
"user_tweets_count<gx:number>":0.0,
"retweets<gx:number>":13471.3749539952,
"favorites<gx:number>":99344.577018021,
"replies<gx:number>":3666.4962808525,
"quotes<gx:number>":3078.002195837
},
"min":{
"id<gx:category>":1.100456021e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212691.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36166.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":85.0,
"favorites<gx:number>":393.0,
"replies<gx:number>":22.0,
"quotes<gx:number>":0.0
},
"25%":{
"id<gx:category>":1.16465648e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212703.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":249.0,
"favorites<gx:number>":1245.5,
"replies<gx:number>":156.0,
"quotes<gx:number>":22.0
},
"50%":{
"id<gx:category>":1.229553614e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212708.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":1218.0,
"favorites<gx:number>":5730.0,
"replies<gx:number>":552.0,
"quotes<gx:number>":90.0
},
"75%":{
"id<gx:category>":1.296563283e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212712.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":4589.5,
"favorites<gx:number>":28466.5,
"replies<gx:number>":2210.0,
"quotes<gx:number>":444.0
},
"max":{
"id<gx:category>":1.391422726e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30308047.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36168.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":205169.0,
"favorites<gx:number>":889245.0,
"replies<gx:number>":29351.0,
"quotes<gx:number>":57012.0
}
}
# Randome sample of 10 rows from the dataframe.
df_random_sample = {
"count":{
"id<gx:category>":491.0,
"author_id<gx:category>":491.0,
"user_favourites_count<gx:number>":491.0,
"user_followers_count<gx:number>":491.0,
"user_following_count<gx:number>":491.0,
"user_listed_count<gx:number>":491.0,
"user_tweets_count<gx:number>":491.0,
"retweets<gx:number>":491.0,
"favorites<gx:number>":491.0,
"replies<gx:number>":491.0,
"quotes<gx:number>":491.0
},
"mean":{
"id<gx:category>":1.230895609e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30218726.7454175167,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0590631365,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":5200.4623217923,
"favorites<gx:number>":41536.8635437882,
"replies<gx:number>":2056.5600814664,
"quotes<gx:number>":754.8859470468
},
"std":{
"id<gx:category>":7.194010391e+16,
"author_id<gx:category>":0.0,
"user_favourites_count<gx:number>":0.0,
"user_followers_count<gx:number>":23210.2101437425,
"user_following_count<gx:number>":0.0,
"user_listed_count<gx:number>":0.2526882771,
"user_tweets_count<gx:number>":0.0,
"retweets<gx:number>":13471.3749539952,
"favorites<gx:number>":99344.577018021,
"replies<gx:number>":3666.4962808525,
"quotes<gx:number>":3078.002195837
},
"min":{
"id<gx:category>":1.100456021e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212691.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36166.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":85.0,
"favorites<gx:number>":393.0,
"replies<gx:number>":22.0,
"quotes<gx:number>":0.0
},
"25%":{
"id<gx:category>":1.16465648e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212703.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":249.0,
"favorites<gx:number>":1245.5,
"replies<gx:number>":156.0,
"quotes<gx:number>":22.0
},
"50%":{
"id<gx:category>":1.229553614e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212708.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":1218.0,
"favorites<gx:number>":5730.0,
"replies<gx:number>":552.0,
"quotes<gx:number>":90.0
},
"75%":{
"id<gx:category>":1.296563283e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30212712.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36167.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":4589.5,
"favorites<gx:number>":28466.5,
"replies<gx:number>":2210.0,
"quotes<gx:number>":444.0
},
"max":{
"id<gx:category>":1.391422726e+18,
"author_id<gx:category>":939091.0,
"user_favourites_count<gx:number>":20.0,
"user_followers_count<gx:number>":30308047.0,
"user_following_count<gx:number>":47.0,
"user_listed_count<gx:number>":36168.0,
"user_tweets_count<gx:number>":7340.0,
"retweets<gx:number>":205169.0,
"favorites<gx:number>":889245.0,
"replies<gx:number>":29351.0,
"quotes<gx:number>":57012.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 2 highest numbers of retweets a tweet in the dataset 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 are the 2 highest numbers of retweets a tweet in the dataset has?
df.columns = ['id<gx:category>', 'author_id<gx:category>', 'author_name<gx:category>', 'author_handler<gx:category>', 'author_avatar<gx:url>', 'user_created_at<gx:date>', 'user_description<gx:text>', 'user_favourites_count<gx:number>', 'user_followers_count<gx:number>', 'user_following_count<gx:number>', 'user_listed_count<gx:number>', 'user_tweets_count<gx:number>', 'user_verified<gx:boolean>', 'user_location<gx:text>', 'lang<gx:category>', 'type<gx:category>', 'text<gx:text>', 'date<gx:date>', 'mention_ids<gx:list[category]>', 'mention_names<gx:list[category]>', 'retweets<gx:number>', 'favorites<gx:number>', 'replies<gx:number>', 'quotes<gx:number>', 'links<gx:list[url]>', 'links_first<gx:url>', 'image_links<gx:list[url]>', 'image_links_first<gx:url>', 'rp_user_id<gx:category>', 'rp_user_name<gx:category>', 'location<gx:text>', 'tweet_link<gx:url>', 'source<gx:text>', 'search<gx:category>']
# Expected output type: is list[number], this will be checked.
return | 20250129013717 |