benchmarks.wiki / Public workspace
BigCodeBench / BigCodeBench v0.1.0_hf 083b2379-c017-5642-9a25-f45132b6ecc7
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
from random import randint
def task_func(num_rows=5, rand_range=(0, 100)):
"""
Create a DataFrame containing random integer values within a specified range for categories 'A' through 'E',
and visualize this data with a stacked bar chart.
Parameters:
num_rows (int): Specifies the number of rows in the DataFrame.
rand_range (tuple): Defines the lower and upper bounds for the random number generation, inclusive.
Returns:
matplotlib.figure.Figure: The matplotlib Figure object containing the plotted data.
Requirements:
- pandas
- matplotlib
- random
Example:
>>> fig = task_func(num_rows=3, rand_range=(10, 50))
>>> type(fig)
<class 'matplotlib.figure.Figure'>
"""
instruct prompt
Create a DataFrame containing random integer values within a specified range for categories 'A' through 'E', and visualize this data with a stacked bar chart.
The function should output with:
matplotlib.figure.Figure: The matplotlib Figure object containing the plotted data.
You should write self-contained code starting with:
Code
import pandas as pd
import matplotlib.pyplot as plt
from random import randint
def task_func(num_rows=5, rand_range=(0, 100)):
code prompt
Code
import pandas as pd
import matplotlib.pyplot as plt
from random import randint
def task_func(num_rows=5, rand_range=(0, 100)):
entry point
task_func
libs
- pandas
- random
- matplotlib
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