benchmarks.wiki / Public workspace
BigCodeBench / BigCodeBench v0.1.0_hf 26c9e1a9-03cc-5d8e-ad8e-39fe41016f5b
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 scipy.stats import skew
def task_func(data_matrix):
"""
Calculate the skew of each row in a 2D data matrix and plot the distribution.
Parameters:
- data_matrix (numpy.array): The 2D data matrix.
Returns:
pandas.DataFrame: A DataFrame containing the skewness of each row. The skweness is stored in a new column which name is 'Skewness'.
matplotlib.axes.Axes: The Axes object of the plotted distribution.
Requirements:
- pandas
- matplotlib.pyplot
- scipy.stats.skew
Example:
>>> import numpy as np
>>> data = np.array([[6, 8, 1, 3, 4], [-1, 0, 3, 5, 1]])
>>> df, ax = task_func(data)
>>> print(df)
Skewness
0 0.122440
1 0.403407
"""
instruct prompt
Calculate the skew of each row in a 2D data matrix and plot the distribution.
The function should output with:
pandas.DataFrame: A DataFrame containing the skewness of each row. The skweness is stored in a new column which name is 'Skewness'.
matplotlib.axes.Axes: The Axes object of the plotted distribution.
You should write self-contained code starting with:
Code
import pandas as pd
import matplotlib.pyplot as plt
from scipy.stats import skew
def task_func(data_matrix):
code prompt
Code
import pandas as pd
import matplotlib.pyplot as plt
from scipy.stats import skew
def task_func(data_matrix):
entry point
task_func
libs
- pandas
- matplotlib
- scipy
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