benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf cf2e71c0-3f38-57f9-99e5-537077a65336

Problem

Answer published by the source. Consult the official source to check your work against its answer.

complete prompt

import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt


def task_func(s1, s2):
    """
    Visualize two Series using a swarm plot with a highlight on their intersecting data points.

    This function creates a swarm plot to visually compare two pandas Series. 
    It highlights the intersection points between these two series by drawing red dashed lines at the intersecting data points.

    Parameters:
    - s1 (pd.Series): The first series of data. This series must have a unique name that identifies it in the plot.
    - s2 (pd.Series): The second series of data. Similar to s1, this series must also have a unique name.

    Returns:
    - ax (matplotlib.Axes): The Axes object of the plotted swarm chart. This object can be used for further customization of the plot if required.
    intersection_count (int): The number of unique intersecting data points between s1 and s2. 
    This count gives a quick numerical summary of the overlap between the two series.

    Requirements:
    - pandas
    - seaborn
    - matplotlib

    Example:
    >>> s1 = pd.Series([1, 2, 3, 4, 5], name='Series1')
    >>> s2 = pd.Series([4, 5, 6, 7, 8], name='Series2')
    >>> ax, count = task_func(s1, s2)
    >>> ax.get_title()
    'Overlap Between Series1 and Series2'
    """

instruct prompt

Visualize two Series using a swarm plot with a highlight on their intersecting data points. This function creates a swarm plot to visually compare two pandas Series. It highlights the intersection points between these two series by drawing red dashed lines at the intersecting data points.
The function should output with:
    ax (matplotlib.Axes): The Axes object of the plotted swarm chart. This object can be used for further customization of the plot if required.
    intersection_count (int): The number of unique intersecting data points between s1 and s2.
    This count gives a quick numerical summary of the overlap between the two series.
You should write self-contained code starting with:

Code

import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
def task_func(s1, s2):

code prompt

Code

import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
def task_func(s1, s2):

entry point

task_func

libs

  • pandas
  • matplotlib
  • seaborn

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