Updated script that can be controled by Nodejs web app

This commit is contained in:
mac OS
2024-11-25 12:24:18 +07:00
parent c440eda1f4
commit 8b0ab2bd3a
8662 changed files with 1803808 additions and 34 deletions

View File

@@ -0,0 +1,39 @@
import pytest
from pandas import (
DataFrame,
Series,
)
import pandas._testing as tm
class TestPipe:
def test_pipe(self, frame_or_series):
obj = DataFrame({"A": [1, 2, 3]})
expected = DataFrame({"A": [1, 4, 9]})
if frame_or_series is Series:
obj = obj["A"]
expected = expected["A"]
f = lambda x, y: x**y
result = obj.pipe(f, 2)
tm.assert_equal(result, expected)
def test_pipe_tuple(self, frame_or_series):
obj = DataFrame({"A": [1, 2, 3]})
obj = tm.get_obj(obj, frame_or_series)
f = lambda x, y: y
result = obj.pipe((f, "y"), 0)
tm.assert_equal(result, obj)
def test_pipe_tuple_error(self, frame_or_series):
obj = DataFrame({"A": [1, 2, 3]})
obj = tm.get_obj(obj, frame_or_series)
f = lambda x, y: y
msg = "y is both the pipe target and a keyword argument"
with pytest.raises(ValueError, match=msg):
obj.pipe((f, "y"), x=1, y=0)