Skip to content

BUG: DataFrame.reindex not following limit - 方法参数的错误 #28631

Closed
@french-home

Description

@french-home

Python版本: 3.6.5
版本:pandas == 0.24.2

import pandas as pd

Data = [
    ["A", "A", "A"],
    ["B", "B", "B"],
    ["C", "C", "C"],
    ["D", "D", "D"],
]
test1 = pd.DataFrame(Data)
print(test1)
print("------------")
test1 = test1.reindex([0, 1, 2, 3, 4, 5], method="ffill", limit=1)
print(test1)

reindex_bug

limit参数限制数据继续向后填充

版本:pandas==0.25.1

import pandas as pd

Data = [
    ["A", "A", "A"],
    ["B", "B", "B"],
    ["C", "C", "C"],
    ["D", "D", "D"],
]
test1 = pd.DataFrame(Data)
print(test1)
print("------------")
test1 = test1.reindex([0, 1, 2, 3, 4, 5], method="ffill", limit=1)
print(test1)

reindex_bug_2

limit参数并没有限制数据继续向后填充

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugIndexingRelated to indexing on series/frames, not to indexes themselvesRegressionFunctionality that used to work in a prior pandas version

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions