Python中的Skiprows参数

Python中的Skiprows参数,python,pandas,Python,Pandas,我在查看Python文档,特别是skiprows,如果可以使用skiprows从第1行跳到第5行,从第70行跳到第101行,但它没有告诉我如何这样做。有人知道怎么做吗?我是否需要为循环创建一个,read\u excel文档缺少对skiprows功能的详细描述。read\u csv更好: skiprows : list-like, int or callable, optional Line numbers to skip (0-indexed) or number of line

我在查看Python文档,特别是skiprows,如果可以使用skiprows从第1行跳到第5行,从第70行跳到第101行,但它没有告诉我如何这样做。有人知道怎么做吗?我是否需要为循环创建一个
read\u excel
文档缺少对
skiprows
功能的详细描述。
read\u csv
更好:

skiprows : list-like, int or callable, optional
        Line numbers to skip (0-indexed) or number of lines to skip (int)
        at the start of the file.
    
        If callable, the callable function will be evaluated against the row
        indices, returning True if the row should be skipped and False otherwise.
        An example of a valid callable argument would be ``lambda x: x in [0, 2]``.
在您的例子中,您可以只列出要跳过的行或使用范围(甚至是lambda)。您的案例有点复杂,因为您想跳过多个范围。假设您想跳过1-5,从0开始计算,您可以

df = pd.read_excel('test.xlsx', skiprows=list(range(1,6)) + list(range(70,102)))


read\u excel
文档没有很好地描述
skiprows
的功能。
read\u csv
更好:

skiprows : list-like, int or callable, optional
        Line numbers to skip (0-indexed) or number of lines to skip (int)
        at the start of the file.
    
        If callable, the callable function will be evaluated against the row
        indices, returning True if the row should be skipped and False otherwise.
        An example of a valid callable argument would be ``lambda x: x in [0, 2]``.
在您的例子中,您可以只列出要跳过的行或使用范围(甚至是lambda)。您的案例有点复杂,因为您想跳过多个范围。假设您想跳过1-5,从0开始计算,您可以

df = pd.read_excel('test.xlsx', skiprows=list(range(1,6)) + list(range(70,102)))


您指的是熊猫.read\u csv
功能吗?
pandas.read\u excel
您指的是熊猫.read\u csv功能吗?
pandas.read\u excel