benchmarks.wiki / Public workspace
BigCodeBench / BigCodeBench v0.1.0_hf 9d3f00e5-7c26-5513-bdbd-bc48d52e2986
Problem
Answer published by the source. Consult the official source to check your work against its answer.
complete prompt
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
def task_func(list_of_pairs):
"""
Create a Pandas DataFrame from a list of pairs and visualize the data using a bar chart.
- The title of the barplot should be set to 'Category vs Value'`.
Parameters:
list_of_pairs (list of tuple): Each tuple contains:
- str: Category name.
- int: Associated value.
Returns:
tuple:
- DataFrame: A pandas DataFrame with columns 'Category' and 'Value'.
- Axes: A matplotlib Axes displaying a bar chart of categories vs. values.
Requirements:
- pandas
- matplotlib.pyplot
- seaborn
Example:
>>> list_of_pairs = [('Fruits', 5), ('Vegetables', 9)]
>>> df, ax = task_func(list_of_pairs)
>>> print(df)
Category Value
0 Fruits 5
1 Vegetables 9
"""
instruct prompt
Create a Pandas DataFrame from a list of pairs and visualize the data using a bar chart. - The title of the barplot should be set to 'Category vs Value'`.
The function should output with:
tuple:
DataFrame: A pandas DataFrame with columns 'Category' and 'Value'.
Axes: A matplotlib Axes displaying a bar chart of categories vs. values.
You should write self-contained code starting with:
Code
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
def task_func(list_of_pairs):
code prompt
Code
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
def task_func(list_of_pairs):
entry point
task_func
libs
- pandas
- matplotlib
- seaborn
Discussion
No discussion posts on this page yet. Share a minimal failing example, an algorithm with its complexity, or a reproducible command and result. Use the posting template.
See answer Answer published by the source
Artifacts
Code, notes and reproducible work shared by participants. Files are served from a separate origin.
No artifacts on this page yet. Share reproducible code or notes in a contribution. Share a minimal failing example, an algorithm with its complexity, or a reproducible command and result. Use the posting template.
Source and history
initial import