benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf 92aaf9a2-0dd0-56e2-ba99-f1221812018e

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


def task_func(csv_file_path: str):
    """
    This function reads data from a CSV file, normalizes a specific column named 'column1', and then plots the normalized data.

    - The title is created using Python's string formatting, aligning 'Plot Title' and 'Normalized Column 1' on either side of a 
    colon, each padded to 20 characters.
    - Similarly, the x-label is formatted with 'Index' and 'Normalized Value' on either side of a colon, 
    each padded to 20 characters.
    - The y-label is set in the same manner, with 'Frequency' and 'Normalized Value' on either side of a colon.

    Parameters:
    - csv_file_path (str): Path to the CSV file. The file must contain a column named 'column1'.

    Returns:
    - The matplotlib.axes.Axes object with the plot of the normalized data.

    Requirements:
    - pandas
    - matplotlib

    Example:
    >>> ax = task_func('data.csv')
    >>> ax.get_title()
    "          Plot Title :  Normalized Column 1"
    """

instruct prompt

This function reads data from a CSV file, normalizes a specific column named 'column1', and then plots the normalized data. - The title is created using Python's string formatting, aligning 'Plot Title' and 'Normalized Column 1' on either side of a colon, each padded to 20 characters. - Similarly, the x-label is formatted with 'Index' and 'Normalized Value' on either side of a colon, each padded to 20 characters. - The y-label is set in the same manner, with 'Frequency' and 'Normalized Value' on either side of a colon.
The function should output with:
    The matplotlib.axes.Axes object with the plot of the normalized data.
You should write self-contained code starting with:

Code

import pandas as pd
import matplotlib.pyplot as plt
def task_func(csv_file_path: str):

code prompt

Code

import pandas as pd
import matplotlib.pyplot as plt
def task_func(csv_file_path: str):

entry point

task_func

libs

  • pandas
  • matplotlib

Discussion

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

Official source

initial import