欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Python 中pandas.read_excel詳細(xì)介紹

 更新時(shí)間:2017年06月23日 11:03:25   投稿:lqh  
這篇文章主要介紹了Python 中pandas.read_excel詳細(xì)介紹的相關(guān)資料,需要的朋友可以參考下

Python 中pandas.read_excel詳細(xì)介紹

#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指定為讀取幾個(gè)sheet,sheet數(shù)目從0開(kāi)始
#如果sheetname=[0,2],那代表讀取第0頁(yè)和第2頁(yè)的sheet
#skiprows=[0]代表讀取跳過(guò)的行數(shù)第0行,不寫(xiě)代表不跳過(guò)標(biāo)題
#df = pd.read_excel(filefullpath, sheetname=None ,skiprows=[0])

print df
print type(df)
#若果有多頁(yè),type(df)就為<type 'dict'>
#如果就一頁(yè),type(df)就為<class 'pandas.core.frame.DataFrame'>
#{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

參數(shù)解析:

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返回的結(jié)果

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.

感謝閱讀,希望能幫助到大家,謝謝大家對(duì)本站的支持!

相關(guān)文章

  • 如何將yolov5中的PANet層改為BiFPN詳析

    如何將yolov5中的PANet層改為BiFPN詳析

    現(xiàn)在yolov5的neck用的是PANet,在efficient論文中提出了BiFPN結(jié)構(gòu),還有更加不錯(cuò)的性能,下面這篇文章主要給大家介紹了關(guān)于如何將yolov5中的PANet層改為BiFPN的相關(guān)資料,需要的朋友可以參考下
    2022-06-06
  • python基礎(chǔ)操作列表切片解析

    python基礎(chǔ)操作列表切片解析

    列表和字符串一樣,列表同樣可以截取和被索引,列表被截取后返回一個(gè)包含所需元素的新列表,List中的元素是可以改變的,需要的朋友可以參考下
    2023-04-04
  • jupyter notebook快速入門(mén)及使用詳解

    jupyter notebook快速入門(mén)及使用詳解

    這篇文章主要介紹了jupyter notebook快速入門(mén)及使用詳解,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2020-11-11
  • python merge、concat合并數(shù)據(jù)集的實(shí)例講解

    python merge、concat合并數(shù)據(jù)集的實(shí)例講解

    下面小編就為大家分享一篇python merge、concat合并數(shù)據(jù)集的實(shí)例講解,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧
    2018-04-04
  • python隨機(jī)取list中的元素方法

    python隨機(jī)取list中的元素方法

    下面小編就為大家分享一篇python隨機(jī)取list中的元素方法,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧
    2018-04-04
  • Python requests模塊基礎(chǔ)使用方法實(shí)例及高級(jí)應(yīng)用(自動(dòng)登陸,抓取網(wǎng)頁(yè)源碼)實(shí)例詳解

    Python requests模塊基礎(chǔ)使用方法實(shí)例及高級(jí)應(yīng)用(自動(dòng)登陸,抓取網(wǎng)頁(yè)源碼)實(shí)例詳解

    這篇文章主要介紹了Python requests模塊基礎(chǔ)使用方法實(shí)例及高級(jí)應(yīng)用(自動(dòng)登陸,抓取網(wǎng)頁(yè)源碼,Cookies)實(shí)例詳解,需要的朋友可以參考下
    2020-02-02
  • pip命令突然無(wú)法使用問(wèn)題以及解決

    pip命令突然無(wú)法使用問(wèn)題以及解決

    當(dāng)你在使用pip安裝Python庫(kù)時(shí)遇到問(wèn)題,可以嘗試以下兩種解決方案,第一種是直接在Scripts文件夾內(nèi)使用CMD命令進(jìn)行安裝,第二種是將Scripts的路徑設(shè)置為系統(tǒng)環(huán)境變量,這樣就可以直接在dos中使用pip install進(jìn)行安裝了,以上解決方案僅供參考,如有更好的方法歡迎交流分享
    2024-10-10
  • python實(shí)現(xiàn)Simhash算法

    python實(shí)現(xiàn)Simhash算法

    這篇文章主要介紹了python實(shí)現(xiàn)Simhash算法,simhash算法用來(lái)進(jìn)行文本比對(duì)的,simhash包含分詞、hash、加權(quán)、合并、降維五大步驟,下文圍繞更多相關(guān)資料介紹,需要的小伙伴可以參考一下
    2022-02-02
  • Python實(shí)現(xiàn)的最近最少使用算法

    Python實(shí)現(xiàn)的最近最少使用算法

    這篇文章主要介紹了Python實(shí)現(xiàn)的最近最少使用算法,涉及節(jié)點(diǎn)、時(shí)間、流程控制等相關(guān)技巧,需要的朋友可以參考下
    2015-07-07
  • python小數(shù)字符串轉(zhuǎn)數(shù)字的五種方法

    python小數(shù)字符串轉(zhuǎn)數(shù)字的五種方法

    本文主要介紹了python小數(shù)字符串轉(zhuǎn)數(shù)字的五種方法,根據(jù)具體需求選擇合適的方法進(jìn)行小數(shù)字符串轉(zhuǎn)數(shù)字,具有一定的參考價(jià)值,感興趣的可以了解一下
    2024-01-01

最新評(píng)論