The following issues were found
pandas/core/arrays/sparse/accessor.py
25 issues
Line: 259
Column: 9
1 0.0 1.0 0.0
2 0.0 0.0 1.0
"""
from pandas._libs.sparse import IntIndex
from pandas import DataFrame
data = data.tocsc()
index, columns = cls._prep_index(data, index, columns)
Reported by Pylint.
Line: 259
Column: 9
1 0.0 1.0 0.0
2 0.0 0.0 1.0
"""
from pandas._libs.sparse import IntIndex
from pandas import DataFrame
data = data.tocsc()
index, columns = cls._prep_index(data, index, columns)
Reported by Pylint.
Line: 333
Column: 9
and uint64 will result in a float64 dtype.
"""
import_optional_dependency("scipy")
from scipy.sparse import coo_matrix
dtype = find_common_type(self._parent.dtypes.to_list())
if isinstance(dtype, SparseDtype):
dtype = dtype.subtype
Reported by Pylint.
Line: 279
Column: 19
for i in range(n_columns):
sl = slice(indptr[i], indptr[i + 1])
idx = IntIndex(n_rows, indices[sl], check_integrity=False)
arr = SparseArray._simple_new(array_data[sl], idx, dtype)
arrays.append(arr)
return DataFrame._from_arrays(
arrays, columns=columns, index=index, verify_integrity=False
)
Reported by Pylint.
Line: 281
Column: 16
idx = IntIndex(n_rows, indices[sl], check_integrity=False)
arr = SparseArray._simple_new(array_data[sl], idx, dtype)
arrays.append(arr)
return DataFrame._from_arrays(
arrays, columns=columns, index=index, verify_integrity=False
)
def to_dense(self):
"""
Reported by Pylint.
Line: 17
Column: 1
from pandas.core.arrays.sparse.dtype import SparseDtype
class BaseAccessor:
_validation_msg = "Can only use the '.sparse' accessor with Sparse data."
def __init__(self, data=None):
self._parent = data
self._validate(data)
Reported by Pylint.
Line: 17
Column: 1
from pandas.core.arrays.sparse.dtype import SparseDtype
class BaseAccessor:
_validation_msg = "Can only use the '.sparse' accessor with Sparse data."
def __init__(self, data=None):
self._parent = data
self._validate(data)
Reported by Pylint.
Line: 44
Column: 9
return getattr(self._parent.array, name)
def _delegate_method(self, name, *args, **kwargs):
if name == "from_coo":
return self.from_coo(*args, **kwargs)
elif name == "to_coo":
return self.to_coo(*args, **kwargs)
else:
raise ValueError
Reported by Pylint.
Line: 52
Column: 5
raise ValueError
@classmethod
def from_coo(cls, A, dense_index=False):
"""
Create a Series with sparse values from a scipy.sparse.coo_matrix.
Parameters
----------
Reported by Pylint.
Line: 93
Column: 9
1 0 3.0
dtype: Sparse[float64, nan]
"""
from pandas import Series
from pandas.core.arrays.sparse.scipy_sparse import coo_to_sparse_series
result = coo_to_sparse_series(A, dense_index=dense_index)
result = Series(result.array, index=result.index, copy=False)
Reported by Pylint.
pandas/tests/frame/methods/test_copy.py
25 issues
Line: 2
Column: 1
import numpy as np
import pytest
import pandas.util._test_decorators as td
from pandas import DataFrame
import pandas._testing as tm
Reported by Pylint.
Line: 26
Column: 9
df = DataFrame({"a": [1]})
df["x"] = [0]
df["a"]
df.copy()
df["a"].values[0] = -1
Reported by Pylint.
Line: 46
Column: 16
# copy objects
copy = float_string_frame.copy()
assert copy._mgr is not float_string_frame._mgr
@td.skip_array_manager_invalid_test
def test_copy_consolidates(self):
# GH#42477
df = DataFrame(
Reported by Pylint.
Line: 46
Column: 33
# copy objects
copy = float_string_frame.copy()
assert copy._mgr is not float_string_frame._mgr
@td.skip_array_manager_invalid_test
def test_copy_consolidates(self):
# GH#42477
df = DataFrame(
Reported by Pylint.
Line: 61
Column: 20
for i in range(0, 10):
df.loc[:, f"n_{i}"] = np.random.randint(0, 100, size=55)
assert len(df._mgr.blocks) == 11
result = df.copy()
assert len(result._mgr.blocks) == 1
Reported by Pylint.
Line: 63
Column: 20
assert len(df._mgr.blocks) == 11
result = df.copy()
assert len(result._mgr.blocks) == 1
Reported by Pylint.
Line: 1
Column: 1
import numpy as np
import pytest
import pandas.util._test_decorators as td
from pandas import DataFrame
import pandas._testing as tm
Reported by Pylint.
Line: 10
Column: 1
import pandas._testing as tm
class TestCopy:
@pytest.mark.parametrize("attr", ["index", "columns"])
def test_copy_index_name_checking(self, float_frame, attr):
# don't want to be able to modify the index stored elsewhere after
# making a copy
ind = getattr(float_frame, attr)
Reported by Pylint.
Line: 12
Column: 5
class TestCopy:
@pytest.mark.parametrize("attr", ["index", "columns"])
def test_copy_index_name_checking(self, float_frame, attr):
# don't want to be able to modify the index stored elsewhere after
# making a copy
ind = getattr(float_frame, attr)
ind.name = None
cp = float_frame.copy()
Reported by Pylint.
Line: 12
Column: 5
class TestCopy:
@pytest.mark.parametrize("attr", ["index", "columns"])
def test_copy_index_name_checking(self, float_frame, attr):
# don't want to be able to modify the index stored elsewhere after
# making a copy
ind = getattr(float_frame, attr)
ind.name = None
cp = float_frame.copy()
Reported by Pylint.
pandas/tests/groupby/aggregate/test_numba.py
25 issues
Line: 2
Column: 1
import numpy as np
import pytest
from pandas.errors import NumbaUtilError
import pandas.util._test_decorators as td
from pandas import (
DataFrame,
Index,
Reported by Pylint.
Line: 61
Column: 9
if jit:
# Test accepted jitted functions
import numba
func_numba = numba.jit(func_numba)
data = DataFrame(
{0: ["a", "a", "b", "b", "a"], 1: [1.0, 2.0, 3.0, 4.0, 5.0]}, columns=[0, 1]
Reported by Pylint.
Line: 93
Column: 9
return np.mean(values) * 2.7
if jit:
import numba
func_1 = numba.jit(func_1)
func_2 = numba.jit(func_2)
data = DataFrame(
Reported by Pylint.
Line: 36
Column: 1
@td.skip_if_no("numba", "0.46.0")
def test_check_nopython_kwargs():
def incorrect_function(x, **kwargs):
return sum(x) * 2.7
data = DataFrame(
{"key": ["a", "a", "b", "b", "a"], "data": [1.0, 2.0, 3.0, 4.0, 5.0]},
columns=["key", "data"],
Reported by Pylint.
Line: 56
Column: 28
@pytest.mark.parametrize("jit", [True, False])
@pytest.mark.parametrize("pandas_obj", ["Series", "DataFrame"])
def test_numba_vs_cython(jit, pandas_obj, nogil, parallel, nopython):
def func_numba(values, index):
return np.mean(values) * 2.7
if jit:
# Test accepted jitted functions
import numba
Reported by Pylint.
Line: 86
Column: 24
@pytest.mark.parametrize("pandas_obj", ["Series", "DataFrame"])
def test_cache(jit, pandas_obj, nogil, parallel, nopython):
# Test that the functions are cached correctly if we switch functions
def func_1(values, index):
return np.mean(values) - 3.4
def func_2(values, index):
return np.mean(values) * 2.7
Reported by Pylint.
Line: 89
Column: 24
def func_1(values, index):
return np.mean(values) - 3.4
def func_2(values, index):
return np.mean(values) * 2.7
if jit:
import numba
Reported by Pylint.
Line: 126
Column: 24
@td.skip_if_no("numba", "0.46.0")
def test_use_global_config():
def func_1(values, index):
return np.mean(values) - 3.4
data = DataFrame(
{0: ["a", "a", "b", "b", "a"], 1: [1.0, 2.0, 3.0, 4.0, 5.0]}, columns=[0, 1]
)
Reported by Pylint.
Line: 164
Column: 26
@td.skip_if_no("numba", "0.46.0")
def test_args_not_cached():
# GH 41647
def sum_last(values, index, n):
return values[-n:].sum()
df = DataFrame({"id": [0, 0, 1, 1], "x": [1, 1, 1, 1]})
grouped_x = df.groupby("id")["x"]
result = grouped_x.agg(sum_last, 1, engine="numba")
Reported by Pylint.
Line: 1
Column: 1
import numpy as np
import pytest
from pandas.errors import NumbaUtilError
import pandas.util._test_decorators as td
from pandas import (
DataFrame,
Index,
Reported by Pylint.
pandas/core/arrays/masked.py
25 issues
Line: 12
Column: 1
import numpy as np
from pandas._libs import (
lib,
missing as libmissing,
)
from pandas._typing import (
ArrayLike,
Reported by Pylint.
Line: 12
Column: 1
import numpy as np
from pandas._libs import (
lib,
missing as libmissing,
)
from pandas._typing import (
ArrayLike,
Reported by Pylint.
Line: 86
Column: 16
@cache_readonly
def kind(self) -> str:
return self.numpy_dtype.kind
@cache_readonly
def itemsize(self) -> int:
"""Return the number of bytes in this dtype"""
return self.numpy_dtype.itemsize
Reported by Pylint.
Line: 91
Column: 16
@cache_readonly
def itemsize(self) -> int:
"""Return the number of bytes in this dtype"""
return self.numpy_dtype.itemsize
@classmethod
def construct_array_type(cls) -> type_t[BaseMaskedArray]:
"""
Return the array type associated with this dtype.
Reported by Pylint.
Line: 341
Column: 9
"""
Convert myself into a pyarrow Array.
"""
import pyarrow as pa
return pa.array(self._data, mask=self._mask, type=type)
@property
def _hasna(self) -> bool:
Reported by Pylint.
Line: 85
Column: 5
return np.dtype(self.type)
@cache_readonly
def kind(self) -> str:
return self.numpy_dtype.kind
@cache_readonly
def itemsize(self) -> int:
"""Return the number of bytes in this dtype"""
Reported by Pylint.
Line: 314
Column: 3
# if we are astyping to another nullable masked dtype, we can fastpath
if isinstance(dtype, BaseMaskedDtype):
# TODO deal with NaNs for FloatingArray case
data = self._data.astype(dtype.numpy_dtype, copy=copy)
# mask is copied depending on whether the data was copied, and
# not directly depending on the `copy` keyword
mask = self._mask if data is self._data else self._mask.copy()
cls = dtype.construct_array_type()
Reported by Pylint.
Line: 324
Column: 20
if isinstance(dtype, ExtensionDtype):
eacls = dtype.construct_array_type()
return eacls._from_sequence(self, dtype=dtype, copy=copy)
raise NotImplementedError("subclass must implement astype to np.dtype")
__array_priority__ = 1000 # higher than ndarray so ops dispatch to us
Reported by Pylint.
Line: 337
Column: 31
"""
return self.to_numpy(dtype=dtype)
def __arrow_array__(self, type=None):
"""
Convert myself into a pyarrow Array.
"""
import pyarrow as pa
Reported by Pylint.
Line: 369
Column: 32
def _concat_same_type(
cls: type[BaseMaskedArrayT], to_concat: Sequence[BaseMaskedArrayT]
) -> BaseMaskedArrayT:
data = np.concatenate([x._data for x in to_concat])
mask = np.concatenate([x._mask for x in to_concat])
return cls(data, mask)
def take(
self: BaseMaskedArrayT,
Reported by Pylint.
pandas/tests/arrays/boolean/test_arithmetic.py
25 issues
Line: 4
Column: 1
import operator
import numpy as np
import pytest
import pandas as pd
import pandas._testing as tm
from pandas.arrays import FloatingArray
Reported by Pylint.
Line: 41
Column: 30
],
ids=["add", "mul"],
)
def test_add_mul(left_array, right_array, opname, exp):
op = getattr(operator, opname)
result = op(left_array, right_array)
expected = pd.array(exp, dtype="boolean")
tm.assert_extension_array_equal(result, expected)
Reported by Pylint.
Line: 41
Column: 18
],
ids=["add", "mul"],
)
def test_add_mul(left_array, right_array, opname, exp):
op = getattr(operator, opname)
result = op(left_array, right_array)
expected = pd.array(exp, dtype="boolean")
tm.assert_extension_array_equal(result, expected)
Reported by Pylint.
Line: 48
Column: 14
tm.assert_extension_array_equal(result, expected)
def test_sub(left_array, right_array):
msg = (
r"numpy boolean subtract, the `-` operator, is (?:deprecated|not supported), "
r"use the bitwise_xor, the `\^` operator, or the logical_xor function instead\."
)
with pytest.raises(TypeError, match=msg):
Reported by Pylint.
Line: 48
Column: 26
tm.assert_extension_array_equal(result, expected)
def test_sub(left_array, right_array):
msg = (
r"numpy boolean subtract, the `-` operator, is (?:deprecated|not supported), "
r"use the bitwise_xor, the `\^` operator, or the logical_xor function instead\."
)
with pytest.raises(TypeError, match=msg):
Reported by Pylint.
Line: 54
Column: 9
r"use the bitwise_xor, the `\^` operator, or the logical_xor function instead\."
)
with pytest.raises(TypeError, match=msg):
left_array - right_array
def test_div(left_array, right_array):
result = left_array / right_array
expected = FloatingArray(
Reported by Pylint.
Line: 57
Column: 14
left_array - right_array
def test_div(left_array, right_array):
result = left_array / right_array
expected = FloatingArray(
np.array(
[1.0, np.inf, np.nan, 0.0, np.nan, np.nan, np.nan, np.nan, np.nan],
dtype="float64",
Reported by Pylint.
Line: 57
Column: 26
left_array - right_array
def test_div(left_array, right_array):
result = left_array / right_array
expected = FloatingArray(
np.array(
[1.0, np.inf, np.nan, 0.0, np.nan, np.nan, np.nan, np.nan, np.nan],
dtype="float64",
Reported by Pylint.
Line: 79
Column: 18
),
],
)
def test_op_int8(left_array, right_array, opname):
op = getattr(operator, opname)
result = op(left_array, right_array)
expected = op(left_array.astype("Int8"), right_array.astype("Int8"))
tm.assert_extension_array_equal(result, expected)
Reported by Pylint.
Line: 79
Column: 30
),
],
)
def test_op_int8(left_array, right_array, opname):
op = getattr(operator, opname)
result = op(left_array, right_array)
expected = op(left_array.astype("Int8"), right_array.astype("Int8"))
tm.assert_extension_array_equal(result, expected)
Reported by Pylint.
pandas/tests/frame/methods/test_to_dict_of_blocks.py
25 issues
Line: 22
Column: 18
column = df.columns[0]
# use the default copy=True, change a column
blocks = df._to_dict_of_blocks(copy=True)
for _df in blocks.values():
if column in _df:
_df.loc[:, column] = _df[column] + 1
# make sure we did not change the original DataFrame
Reported by Pylint.
Line: 28
Column: 20
_df.loc[:, column] = _df[column] + 1
# make sure we did not change the original DataFrame
assert not _df[column].equals(df[column])
def test_no_copy_blocks(self, float_frame):
# GH#9607
df = DataFrame(float_frame, copy=True)
column = df.columns[0]
Reported by Pylint.
Line: 36
Column: 18
column = df.columns[0]
# use the copy=False, change a column
blocks = df._to_dict_of_blocks(copy=False)
for _df in blocks.values():
if column in _df:
_df.loc[:, column] = _df[column] + 1
# make sure we did change the original DataFrame
Reported by Pylint.
Line: 42
Column: 16
_df.loc[:, column] = _df[column] + 1
# make sure we did change the original DataFrame
assert _df[column].equals(df[column])
def test_to_dict_of_blocks_item_cache():
# Calling to_dict_of_blocks should not poison item_cache
df = DataFrame({"a": [1, 2, 3, 4], "b": ["a", "b", "c", "d"]})
Reported by Pylint.
Line: 49
Column: 11
# Calling to_dict_of_blocks should not poison item_cache
df = DataFrame({"a": [1, 2, 3, 4], "b": ["a", "b", "c", "d"]})
df["c"] = PandasArray(np.array([1, 2, None, 3], dtype=object))
mgr = df._mgr
assert len(mgr.blocks) == 3 # i.e. not consolidated
ser = df["b"] # populations item_cache["b"]
df._to_dict_of_blocks()
Reported by Pylint.
Line: 54
Column: 5
ser = df["b"] # populations item_cache["b"]
df._to_dict_of_blocks()
# Check that the to_dict_of_blocks didn't break link between ser and df
ser.values[0] = "foo"
assert df.loc[0, "b"] == "foo"
Reported by Pylint.
Line: 69
Column: 14
df = DataFrame([[1.0, 2, 3], [4.0, 5, 6]], columns=cols)
df["2nd"] = df["2nd"] * 2.0
blocks = df._to_dict_of_blocks()
assert sorted(blocks.keys()) == ["float64", "int64"]
tm.assert_frame_equal(
blocks["float64"], DataFrame([[1.0, 4.0], [4.0, 10.0]], columns=cols[:2])
)
tm.assert_frame_equal(blocks["int64"], DataFrame([[3], [6]], columns=cols[2:]))
Reported by Pylint.
Line: 1
Column: 1
import numpy as np
import pandas.util._test_decorators as td
from pandas import (
DataFrame,
MultiIndex,
)
import pandas._testing as tm
Reported by Pylint.
Line: 15
Column: 1
pytestmark = td.skip_array_manager_invalid_test
class TestToDictOfBlocks:
def test_copy_blocks(self, float_frame):
# GH#9607
df = DataFrame(float_frame, copy=True)
column = df.columns[0]
Reported by Pylint.
Line: 16
Column: 5
class TestToDictOfBlocks:
def test_copy_blocks(self, float_frame):
# GH#9607
df = DataFrame(float_frame, copy=True)
column = df.columns[0]
# use the default copy=True, change a column
Reported by Pylint.
pandas/_testing/_io.py
25 issues
Line: 195
Column: 5
Errors not related to networking will always be raised.
"""
from pytest import skip
if error_classes is None:
error_classes = _get_default_network_errors()
t.network = True
Reported by Pylint.
Line: 216
Column: 33
errno = getattr(err, "errno", None)
if not errno and hasattr(errno, "reason"):
# error: "Exception" has no attribute "reason"
errno = getattr(err.reason, "errno", None) # type: ignore[attr-defined]
if errno in skip_errnos:
skip(f"Skipping test due to known errno and error {err}")
e_str = str(err)
Reported by Pylint.
Line: 316
Column: 5
pandas object
The original object that was serialized and then re-read.
"""
import pytest
Path = pytest.importorskip("pathlib").Path
if path is None:
path = "___pathlib___"
with ensure_clean(path) as path:
Reported by Pylint.
Line: 345
Column: 5
pandas object
The original object that was serialized and then re-read.
"""
import pytest
LocalPath = pytest.importorskip("py.path").local
if path is None:
path = "___localpath___"
with ensure_clean(path) as path:
Reported by Pylint.
Line: 212
Column: 16
skip()
try:
return t(*args, **kwargs)
except Exception as err:
errno = getattr(err, "errno", None)
if not errno and hasattr(errno, "reason"):
# error: "Exception" has no attribute "reason"
errno = getattr(err.reason, "errno", None) # type: ignore[attr-defined]
Reported by Pylint.
Line: 1
Column: 1
from __future__ import annotations
import bz2
from functools import wraps
import gzip
from typing import (
Any,
Callable,
)
Reported by Pylint.
Line: 71
Column: 5
def _get_default_network_errors():
# Lazy import for http.client because it imports many things from the stdlib
import http.client
return (IOError, http.client.HTTPException, TimeoutError)
def optional_args(decorator):
Reported by Pylint.
Line: 90
Column: 9
@wraps(decorator)
def wrapper(*args, **kwargs):
def dec(f):
return decorator(f, *args, **kwargs)
is_decorating = not kwargs and len(args) == 1 and callable(args[0])
if is_decorating:
f = args[0]
Reported by Pylint.
Line: 94
Column: 9
return decorator(f, *args, **kwargs)
is_decorating = not kwargs and len(args) == 1 and callable(args[0])
if is_decorating:
f = args[0]
args = ()
return dec(f)
else:
return dec
Reported by Pylint.
Line: 95
Column: 13
is_decorating = not kwargs and len(args) == 1 and callable(args[0])
if is_decorating:
f = args[0]
args = ()
return dec(f)
else:
return dec
Reported by Pylint.
pandas/tests/groupby/transform/test_numba.py
25 issues
Line: 1
Column: 1
import pytest
from pandas.errors import NumbaUtilError
import pandas.util._test_decorators as td
from pandas import (
DataFrame,
Series,
option_context,
Reported by Pylint.
Line: 58
Column: 9
if jit:
# Test accepted jitted functions
import numba
func = numba.jit(func)
data = DataFrame(
{0: ["a", "a", "b", "b", "a"], 1: [1.0, 2.0, 3.0, 4.0, 5.0]}, columns=[0, 1]
Reported by Pylint.
Line: 90
Column: 9
return values * 5
if jit:
import numba
func_1 = numba.jit(func_1)
func_2 = numba.jit(func_2)
data = DataFrame(
Reported by Pylint.
Line: 33
Column: 1
@td.skip_if_no("numba", "0.46.0")
def test_check_nopython_kwargs():
def incorrect_function(x, **kwargs):
return x + 1
data = DataFrame(
{"key": ["a", "a", "b", "b", "a"], "data": [1.0, 2.0, 3.0, 4.0, 5.0]},
columns=["key", "data"],
Reported by Pylint.
Line: 53
Column: 22
@pytest.mark.parametrize("jit", [True, False])
@pytest.mark.parametrize("pandas_obj", ["Series", "DataFrame"])
def test_numba_vs_cython(jit, pandas_obj, nogil, parallel, nopython):
def func(values, index):
return values + 1
if jit:
# Test accepted jitted functions
import numba
Reported by Pylint.
Line: 83
Column: 24
@pytest.mark.parametrize("pandas_obj", ["Series", "DataFrame"])
def test_cache(jit, pandas_obj, nogil, parallel, nopython):
# Test that the functions are cached correctly if we switch functions
def func_1(values, index):
return values + 1
def func_2(values, index):
return values * 5
Reported by Pylint.
Line: 86
Column: 24
def func_1(values, index):
return values + 1
def func_2(values, index):
return values * 5
if jit:
import numba
Reported by Pylint.
Line: 123
Column: 24
@td.skip_if_no("numba", "0.46.0")
def test_use_global_config():
def func_1(values, index):
return values + 1
data = DataFrame(
{0: ["a", "a", "b", "b", "a"], 1: [1.0, 2.0, 3.0, 4.0, 5.0]}, columns=[0, 1]
)
Reported by Pylint.
Line: 155
Column: 26
@td.skip_if_no("numba", "0.46.0")
def test_args_not_cached():
# GH 41647
def sum_last(values, index, n):
return values[-n:].sum()
df = DataFrame({"id": [0, 0, 1, 1], "x": [1, 1, 1, 1]})
grouped_x = df.groupby("id")["x"]
result = grouped_x.transform(sum_last, 1, engine="numba")
Reported by Pylint.
Line: 1
Column: 1
import pytest
from pandas.errors import NumbaUtilError
import pandas.util._test_decorators as td
from pandas import (
DataFrame,
Series,
option_context,
Reported by Pylint.
pandas/io/sas/sas_xport.py
25 issues
Line: 28
Column: 1
from pandas.io.common import get_handle
from pandas.io.sas.sasreader import ReaderBase
_correct_line1 = (
"HEADER RECORD*******LIBRARY HEADER RECORD!!!!!!!"
"000000000000000000000000000000 "
)
_correct_header1 = (
"HEADER RECORD*******MEMBER HEADER RECORD!!!!!!!000000000000000001600000000"
Reported by Pylint.
Line: 32
Column: 1
"HEADER RECORD*******LIBRARY HEADER RECORD!!!!!!!"
"000000000000000000000000000000 "
)
_correct_header1 = (
"HEADER RECORD*******MEMBER HEADER RECORD!!!!!!!000000000000000001600000000"
)
_correct_header2 = (
"HEADER RECORD*******DSCRPTR HEADER RECORD!!!!!!!"
"000000000000000000000000000000 "
Reported by Pylint.
Line: 35
Column: 1
_correct_header1 = (
"HEADER RECORD*******MEMBER HEADER RECORD!!!!!!!000000000000000001600000000"
)
_correct_header2 = (
"HEADER RECORD*******DSCRPTR HEADER RECORD!!!!!!!"
"000000000000000000000000000000 "
)
_correct_obs_header = (
"HEADER RECORD*******OBS HEADER RECORD!!!!!!!"
Reported by Pylint.
Line: 39
Column: 1
"HEADER RECORD*******DSCRPTR HEADER RECORD!!!!!!!"
"000000000000000000000000000000 "
)
_correct_obs_header = (
"HEADER RECORD*******OBS HEADER RECORD!!!!!!!"
"000000000000000000000000000000 "
)
_fieldkeys = [
"ntype",
Reported by Pylint.
Line: 63
Column: 1
]
_base_params_doc = """\
Parameters
----------
filepath_or_buffer : str or file-like object
Path to SAS file or object implementing binary read method."""
Reported by Pylint.
Line: 69
Column: 1
filepath_or_buffer : str or file-like object
Path to SAS file or object implementing binary read method."""
_params2_doc = """\
index : identifier of index column
Identifier of column that should be used as index of the DataFrame.
encoding : str
Encoding for text data.
chunksize : int
Reported by Pylint.
Line: 77
Column: 1
chunksize : int
Read file `chunksize` lines at a time, returns iterator."""
_format_params_doc = """\
format : str
File format, only `xport` is currently supported."""
_iterator_doc = """\
iterator : bool, default False
Reported by Pylint.
Line: 81
Column: 1
format : str
File format, only `xport` is currently supported."""
_iterator_doc = """\
iterator : bool, default False
Return XportReader object for reading file incrementally."""
_read_sas_doc = f"""Read a SAS file into a DataFrame.
Reported by Pylint.
Line: 125
Column: 1
Contains information about the variables in the file
"""
_read_method_doc = """\
Read observations from SAS Xport file, returning as data frame.
Parameters
----------
nrows : int
Reported by Pylint.
Line: 149
Column: 1
return pd.NaT
def _split_line(s: str, parts):
"""
Parameters
----------
s: str
Fixed-length string to split
Reported by Pylint.
pandas/core/reshape/melt.py
25 issues
Line: 141
Column: 31
if is_extension_array_dtype(id_data):
id_data = cast("Series", concat([id_data] * K, ignore_index=True))
else:
id_data = np.tile(id_data._values, K)
mdata[col] = id_data
mcolumns = id_vars + var_name + [value_name]
# error: Incompatible types in assignment (expression has type "ndarray",
Reported by Pylint.
Line: 148
Column: 25
# error: Incompatible types in assignment (expression has type "ndarray",
# target has type "Series")
mdata[value_name] = frame._values.ravel("F") # type: ignore[assignment]
for i, col in enumerate(var_name):
# asanyarray will keep the columns as an Index
# error: Incompatible types in assignment (expression has type "ndarray", target
# has type "Series")
Reported by Pylint.
Line: 155
Column: 13
# error: Incompatible types in assignment (expression has type "ndarray", target
# has type "Series")
mdata[col] = np.asanyarray( # type: ignore[assignment]
frame.columns._get_level_values(i)
).repeat(N)
result = frame._constructor(mdata, columns=mcolumns)
if not ignore_index:
Reported by Pylint.
Line: 158
Column: 14
frame.columns._get_level_values(i)
).repeat(N)
result = frame._constructor(mdata, columns=mcolumns)
if not ignore_index:
result.index = tile_compat(frame.index, K)
return result
Reported by Pylint.
Line: 167
Column: 60
@deprecate_kwarg(old_arg_name="label", new_arg_name=None)
def lreshape(data: DataFrame, groups, dropna: bool = True, label=None) -> DataFrame:
"""
Reshape wide-format data to long. Generalized inverse of DataFrame.pivot.
Accepts a dictionary, ``groups``, in which each key is a new column name
and each value is a list of old column names that will be "melted" under
Reported by Pylint.
Line: 243
Column: 22
pivot_cols = []
for target, names in zip(keys, values):
to_concat = [data[col]._values for col in names]
mdata[target] = concat_compat(to_concat)
pivot_cols.append(target)
for col in id_cols:
Reported by Pylint.
Line: 249
Column: 30
pivot_cols.append(target)
for col in id_cols:
mdata[col] = np.tile(data[col]._values, K)
if dropna:
mask = np.ones(len(mdata[pivot_cols[0]]), dtype=bool)
for c in pivot_cols:
mask &= notna(mdata[c])
Reported by Pylint.
Line: 258
Column: 12
if not mask.all():
mdata = {k: v[mask] for k, v in mdata.items()}
return data._constructor(mdata, columns=id_cols + pivot_cols)
def wide_to_long(
df: DataFrame, stubnames, i, j, sep: str = "", suffix: str = r"\d+"
) -> DataFrame:
Reported by Pylint.
Line: 1
Column: 1
from __future__ import annotations
import re
from typing import (
TYPE_CHECKING,
cast,
)
import warnings
Reported by Pylint.
Line: 44
Column: 1
@Appender(_shared_docs["melt"] % {"caller": "pd.melt(df, ", "other": "DataFrame.melt"})
def melt(
frame: DataFrame,
id_vars=None,
value_vars=None,
var_name=None,
value_name="value",
Reported by Pylint.