| Server IP : 209.209.40.120 / Your IP : 216.73.217.112 Web Server : Microsoft-IIS/10.0 System : Windows NT NEWWWW 10.0 build 17763 (Windows Server 2019) i586 User : NEWWWW$ ( 0) PHP Version : 8.3.30 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/Python312/Lib/site-packages/pandas/tests/frame/methods/ |
Upload File : |
import numpy as np
import pytest
from pandas import DataFrame
@pytest.mark.parametrize(
"data, index, expected",
[
({"col1": [1], "col2": [3]}, None, 2),
({}, None, 0),
({"col1": [1, np.nan], "col2": [3, 4]}, None, 4),
({"col1": [1, 2], "col2": [3, 4]}, [["a", "b"], [1, 2]], 4),
({"col1": [1, 2, 3, 4], "col2": [3, 4, 5, 6]}, ["x", "y", "a", "b"], 8),
],
)
def test_size(data, index, expected):
# GH#52897
df = DataFrame(data, index=index)
assert df.size == expected
assert isinstance(df.size, int)