glucopy.read_excel#
- glucopy.read_excel(path, sheet_name: str | int | list | None = 0, date_column: list[str] | str | int = 0, cgm_column: str | int = 1, unit: str = 'mg/dL', skiprows: Sequence[int] | int | Callable[[int], object] | None = None, nrows: int | None = None)[source]#
Use pandas.read_excel to read an excel file into a Gframe object
- Parameters:
path (str, bytes, ExcelFile, xlrd.Book, path object, or file-like object) – Any valid string path is acceptable. The string could be a URL. Valid URL schemes include http, ftp, s3, and file. For more information view the documentation for pandas.read_excel
sheet_name (str, int, list, 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. For more information view the documentation for pandas.read_excel
Available cases:
Defaults to
0
: 1st sheet as a GFrame1
: 2nd sheet as a GFrame"Sheet1"
: Load sheet with name “Sheet1”[0, 1, "Sheet5"]
: Load first, second and sheet named “Sheet5”as a dict of GFrame
None: All worksheets.
date_column (str or list of str, default None) –
Column name(s) of the date values, max 2 columns, if None, the first
Available cases: * Defaults to
None
: first column will be used as date *"Date"
: column named “Date” will be used as date *["Date", "Time"]
: columns named “Date” and “Time” will be used as datecgm_column (str or None, default None) – Column name of the CGM values, if None, the second column will be used
unit (str, default 'mg/dL') – Unit of the Glucose values
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. For more information view the documentation for pandas.read_excel
nrows (int, default None) – Number of rows to read.
- Returns:
Gframe object
- Return type:
Examples
Read an excel file with the first column as date and the second as cgm values (default)
>>> import glucopy as gp >>> gf = gp.read_excel('data.xlsx')
Read an excel file with the data column named ‘Date’ and the cgm column named ‘CGM’
>>> gf = gp.read_excel('data.xlsx', date_column='Date', cgm_column='CGM')