Python 中pandas.read_excel详细介绍

#coding:utf-8

import pandas as pd

import numpy as np

filefullpath = r"/home/geeklee/temp/all_gov_file/pol_gov_mon/downloads/1.xls"

#filefullpath = r"/home/geeklee/temp/all_gov_file/pol_gov_mon/downloads/26368f3a-ea03-46b9-8033-73615ed07816.xls"

df = pd.read_excel(filefullpath,skiprows=[0])

#df = pd.read_excel(filefullpath, sheetname=[0,2],skiprows=[0])

#sheetname指定为读取几个sheet,sheet数目从0开始

#如果sheetname=[0,2],那代表读取第0页和第2页的sheet

#skiprows=[0]代表读取跳过的行数第0行,不写代表不跳过标题

#df = pd.read_excel(filefullpath, sheetname=None ,skiprows=[0])

print df

print type(df)

#若果有多页,type(df)就为

#如果就一页,type(df)就为

#{0:dataframe,1:dataframe,2:dataframe}

pandas.read_excel(io, sheetname=0, header=0, skiprows=None, skip_footer=0,

index_col=None, names=None, parse_cols=None, parse_dates=False, date_parser=None,

na_values=None, thousands=None, convert_float=True, has_index_names=None, converters=None,

engine=None, squeeze=False, **kwds)

Read an Excel table into a pandas DataFrame

参数解析:

io : string, path object (pathlib.Path or py._path.local.LocalPath),

file-like object, pandas ExcelFile, or xlrd workbook. The string could be a URL. Valid URL schemes include http, ftp, s3, and file. For file URLs, a host is expected. For instance, a local file could be file://localhost/path/to/workbook.xlsx

sheetname : string, int, mixed list of strings/ints, or None, default 0

Strings are used for sheet names, Integers are used in zero-indexed sheet positions.

Lists of strings/integers are used to request multiple sheets.

Specify None to get all sheets.

str|int -> DataFrame is returned. list|None -> Dict of DataFrames is returned, with keys representing sheets.

Available Cases

Defaults to 0 -> 1st sheet as a DataFrame

1 -> 2nd sheet as a DataFrame

“Sheet1” -> 1st sheet as a DataFrame

[0,1,”Sheet5”] -> 1st, 2nd & 5th sheet as a dictionary of DataFrames

None -> All sheets as a dictionary of DataFrames

header : int, list of ints, default 0

Row (0-indexed) to use for the column labels of the parsed DataFrame. If a list of integers is passed those row positions will be combined into a MultiIndex

skiprows : list-like

Rows to skip at the beginning (0-indexed)

skip_footer : int, default 0

Rows at the end to skip (0-indexed)

index_col : int, list of ints, default None

Column (0-indexed) to use as the row labels of the DataFrame. Pass None if there is no such column. If a list is passed, those columns will be combined into a MultiIndex

names : array-like, default None

List of column names to use. If file contains no header row, then you should explicitly pass header=None

converters : dict, default None

Dict of functions for converting values in certain columns. Keys can either be integers or column labels, values are functions that take one input argument, the Excel cell content, and return the transformed content.

parse_cols : int or list, default None

If None then parse all columns,

If int then indicates last column to be parsed

If list of ints then indicates list of column numbers to be parsed

If string then indicates comma separated list of column names and column ranges (e.g. “A:E” or “A,C,E:F”)

squeeze : boolean, default False

If the parsed data only contains one column then return a Series

na_values : list-like, default None

List of additional strings to recognize as NA/NaN

thousands : str, default None

Thousands separator for parsing string columns to numeric. Note that this parameter is only necessary for columns stored as TEXT in Excel, any numeric columns will automatically be parsed, regardless of display format.

keep_default_na : bool, default True

If na_values are specified and keep_default_na is False the default NaN values are overridden, otherwise they're appended to

verbose : boolean, default False

Indicate number of NA values placed in non-numeric columns

engine: string, default None

If io is not a buffer or path, this must be set to identify io. Acceptable values are None or xlrd

convert_float : boolean, default True

convert integral floats to int (i.e., 1.0 –> 1). If False, all numeric data will be read in as floats: Excel stores all numbers as floats internally

has_index_names : boolean, default None

DEPRECATED: for version 0.17+ index names will be automatically inferred based on index_col. To read Excel output from 0.16.2 and prior that had saved index names, use True.

return返回的结果

parsed : DataFrame or Dict of DataFrames

DataFrame from the passed in Excel file. See notes in sheetname argument for more information on when a Dict of Dataframes is returned.

感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!

pythonexcel介绍_Python 中pandas.read_excel详细介绍相关推荐

  1. elementui的css文件没有引入_Python中引入模块详细介绍,使用模块的过程中注意事项教程...

    ​ 为此 Python 提供了一个办法,把这些定义存放在文件中,这个文件被称为模块. 模块是一个包含所有你定义的函数和变量的文件,其后缀名是.py.模块可以被别的程序引入,以使用该模块中的函数等功能. ...

  2. python闭包应用实例_Python中的闭包详细介绍和实例

    一.闭包 来自wiki: 闭包(Closure)是词法闭包(Lexical Closure)的简称,是引用了自由变量的函数.这个被引用的自由变量将和这个函数一同存在,即使已经离开了创造它的环境也不例外 ...

  3. python中字典的基本形式是什么_python中的字典详细介绍

    2014 一.什么是字典? 字典是Python语言中唯一的映射类型. 映射类型对象里哈希值(键,key)和指向的对象(值,value)是一对多的的关系,通常被认为是可变的哈希表. 字典对象是可变的,它 ...

  4. 2020-12-09 深度学习 卷积神经网络中感受野的详细介绍

    卷积神经网络中感受野的详细介绍 1. 感受野的概念 在卷积神经网络中,感受野(Receptive Field)的定义是卷积神经网络每一层输出的特征图(feature map)上的像素点在输入图片上映射 ...

  5. Android manifest文件中的标签详细介绍

    Android manifest文件中的标签详细介绍 概要 每一个Android应用都应该包含一个manifest文件,即AndroidManifest.xml.它包含了程序运行的一些必备信息,比如: ...

  6. python中soup_python中BeautifulSoup的详细介绍(附代码)

    本篇文章给大家带来的内容是关于python中BeautifulSoup的详细介绍(附代码),有一定的参考价值,有需要的朋友可以参考一下,希望对你有所帮助. Beautiful Soup提供一些简单的. ...

  7. 位在c语言中用什么定义,C语言中位段的详细介绍

    C语言中位段的详细介绍 位段(bit-field)是以位为单位来定义结构体(或联合体)中的成员变量所占的空间.含有位段的结构体(联合体)称为位段结构.采用位段结构既能够节省空间,又方便于操作.以下是百 ...

  8. linux的run目录,Linux 中run 目录详细介绍

    原标题:Linux 中run 目录详细介绍 /run 是各种各样数据的家园.例如,如果你查看 /run/user,你会注意到一组带有数字名称的目录. $ ls /run/user 1000 1002 ...

  9. csp怎么给线条描边_CSP优动漫PAINT中基本功能详细介绍

    今天我们来看一下CSP优动漫PAINT中基本功能详细介绍,有不清楚的小伙伴,一起来了解一下吧. CSP优动漫PAINT中基本功能详细介绍 颜色丰富多彩.笔感自然真实 通过高级笔压感应功能,展现自然真实 ...

最新文章

  1. vue修改节点class_Vue2.0 源码解读系列 来自 Vue 的神秘礼盒
  2. PCL中异常处理机制
  3. ios APP开发简单实例
  4. [转]bootstrapTable refresh 方法使用简单举例
  5. 知识蒸馏 循环蒸馏_Java垃圾收集蒸馏
  6. ClickHouse 源码阅读 —— SQL的前世今生
  7. Git学习总结(4)——我的Git忽略文件与忽略文件提交规则和配置总结
  8. go导出mysql中的excel表,MySQL导出数据,并转存到Excel表格中
  9. 基于深度学习的短视频内容分析简介
  10. DevOps-2-从凤凰项目谈起
  11. mysqld --initialize 错误:mysqld: Can‘t create/write to file ‘G: ool\mysql\data\is_writable‘
  12. 网易云音乐api歌单数据获取
  13. MC1488 MC1489
  14. 关于面试的方法和技巧都有哪些呢?
  15. 中国大学慕课第8周测验
  16. python画图代码大全-纯干货:手把手教你用Python做数据可视化(附代码)
  17. strcasecmp函数用法
  18. MFC 右键菜单呼出
  19. 一致性hash算法虚拟节点解决方案
  20. 《吴军 阅读与习作讲义》 序和第3章 日常实用写作

热门文章

  1. 人工智能专业太卷,发不出好文章?看看顶刊审稿人怎么说...
  2. Facebook 万字长文:AI 模型全部迁移至 PyTorch 框架
  3. 清华团队曝光「新冠病毒」3D高清结构照!这个恶魔已感染1亿地球人
  4. 参考文献必备神器:这个插件能快速知道收藏的论文是否靠谱
  5. YOLOv5的妙用:学习手语,帮助听力障碍群体
  6. 操作系统学习:Linux0.12初始化详细流程-进程退出与系统进入怠速
  7. 百面机器学习之模型评估
  8. EXE文件中的程序的加载过程 SA是什么呢?PSP是什么?
  9. VUE的本地应用-V-TEXT
  10. SLAM基础:相机与图像