benchmarks.wiki / Public workspace
BigCodeBench / BigCodeBench v0.1.0_hf 71e2cc5d-1013-5451-b3a6-ae89d0e5daed
Problem
Answer published by the source. Consult the official source to check your work against its answer.
complete prompt
import numpy as np
import pandas as pd
def task_func(students=["Alice", "Bob", "Charlie", "David", "Eve"], seed=42):
"""
Generate random scores for a given list of students, sort these scores in ascending order,
and return both the scores and a bar plot of these scores.
Parameters:
students (list of str): List of student names.
seed (int): Seed for the random number generator. Default is 42.
Returns:
DataFrame: A pandas DataFrame with columns 'Student' and 'Score', sorted by 'Score'.
Axes: A matplotlib Axes object containing the bar plot of scores.
use np.random.randint(0, 100) to generate the scores of the students
Requirements:
- numpy
- pandas
Example:
>>> scores, plot = task_func()
>>> print(scores)
Student Score
2 Charlie 14
0 Alice 51
4 Eve 60
3 David 71
1 Bob 92
"""
instruct prompt
Generate random scores for a given list of students, sort these scores in ascending order, and return both the scores and a bar plot of these scores. use np.random.randint(0, 100) to generate the scores of the students
The function should output with:
DataFrame: A pandas DataFrame with columns 'Student' and 'Score', sorted by 'Score'.
Axes: A matplotlib Axes object containing the bar plot of scores.
You should write self-contained code starting with:
Code
import numpy as np
import pandas as pd
def task_func(students=["Alice", "Bob", "Charlie", "David", "Eve"], seed=42):
code prompt
Code
import numpy as np
import pandas as pd
def task_func(students=["Alice", "Bob", "Charlie", "David", "Eve"], seed=42):
entry point
task_func
libs
- pandas
- numpy
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