Module Expr Str Import alias Import alias FunctionDef arguments args NameParam NameParam NameParam defaults NameLoad NameLoad body Expr Str Assign NameStore Call AttributeLoad SubscriptLoad NameLoad Index Num attr Assign NameStore Dict Assign NameStore Dict Assign NameStore Dict For NameStore NameLoad body For NameStore NameLoad body If CompareEq SubscriptLoad NameLoad Index NameLoad Str body Continue Assign SubscriptStore NameLoad Index NameLoad NameLoad If Call NameLoad SubscriptLoad NameLoad Index NameLoad NameLoad body Assign NameStore AttributeLoad NameLoad attr If CompareNotIn NameLoad NameLoad body Assign SubscriptStore NameLoad Index NameLoad Call NameLoad SubscriptLoad NameLoad Index NameLoad orelse Assign SubscriptStore NameLoad Index NameLoad Call NameLoad NameLoad Call NameLoad SubscriptLoad NameLoad Index NameLoad orelse If Call NameLoad SubscriptLoad NameLoad Index NameLoad NameLoad body Assign NameStore AttributeLoad NameLoad attr orelse Continue Assign SubscriptStore NameLoad Index NameLoad NameLoad Assign NameStore ListLoad For NameStore NameLoad body If CompareNotIn NameLoad NameLoad body If BoolOpOr CompareIn NameLoad NameLoad UnaryOpNot NameLoad body Assign SubscriptStore NameLoad Index NameLoad AttributeLoad NameLoad attr orelse Expr Call AttributeLoad NameLoad attr NameLoad If NameLoad body Return TupleLoad NameLoad NameLoad NameLoad orelse Return TupleLoad NameLoad NameLoad decorator_list ClassDef bases body Expr Str FunctionDef arguments args NameParam NameParam defaults body Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body Return NameLoad decorator_list FunctionDef arguments args NameParam defaults body While Num body Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr If CompareIs NameLoad NameLoad body Raise NameLoad If BoolOpAnd CompareNotEq Call AttributeLoad NameLoad attr Str UnaryOpNot Call AttributeLoad NameLoad attr Str body Return NameLoad decorator_list decorator_list ClassDef bases AttributeLoad NameLoad attr body Expr Str FunctionDef arguments args NameParam NameParam defaults vararg kwarg body Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Call NameLoad NameLoad NameLoad NameLoad decorator_list decorator_list ClassDef bases NameLoad body FunctionDef arguments args NameParam NameParam NameParam defaults Str kwarg body Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr NameLoad NameLoad Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body Return NameLoad decorator_list FunctionDef arguments args NameParam defaults body Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr Return ListComp Call NameLoad NameLoad AttributeLoad NameLoad attr comprehension NameStore NameLoad decorator_list FunctionDef arguments args NameParam defaults body Return AttributeLoad AttributeLoad NameLoad attr attr decorator_list NameLoad decorator_list ClassDef bases AttributeLoad NameLoad attr body FunctionDef arguments args NameParam NameParam NameParam NameParam defaults Str NameLoad kwarg body Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad NameLoad keyword NameLoad NameLoad Assign AttributeStore NameLoad attr Call NameLoad NameLoad keyword NameLoad NameLoad decorator_list decorator_list ClassDef bases body Expr Str FunctionDef arguments args NameParam NameParam NameParam defaults vararg kwarg body Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr Call NameLoad NameLoad decorator_list FunctionDef arguments args NameParam defaults body Return NameLoad decorator_list FunctionDef arguments args NameParam defaults body Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr If UnaryOpNot NameLoad body Raise NameLoad Assign NameStore Call AttributeLoad SubscriptLoad NameLoad Slice Num attr Str Assert CompareEq Call NameLoad NameLoad AttributeLoad NameLoad attr Return Call NameLoad Call NameLoad AttributeLoad NameLoad attr NameLoad decorator_list decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam defaults NameLoad NameLoad NameLoad Str body Expr Str Assign NameStore ListComp NameLoad comprehension NameStore NameLoad CompareNotEq SubscriptLoad NameLoad Index Num Str If CompareEq Call NameLoad NameLoad Num body Return TupleLoad ListLoad ListLoad If NameLoad body Assign NameStore Call AttributeLoad SubscriptLoad SubscriptLoad NameLoad Index Num Slice Num attr Str Delete SubscriptDel NameLoad Index Num orelse Assign NameStore Call AttributeLoad SubscriptLoad SubscriptLoad NameLoad Index Num Slice Num attr Str Assign NameStore Call NameLoad NameLoad Call NameLoad Call NameLoad NameLoad Assign NameStore Call NameLoad NameLoad TryExcept body Assign NameStore Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr keyword NameLoad handlers ExceptHandler type NameLoad body Assign NameStore Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Assign NameStore Call NameLoad NameLoad If NameLoad body Assign NameStore ListComp NameLoad comprehension NameStore NameLoad CompareEq Call NameLoad NameLoad NameLoad orelse For TupleStore NameStore NameStore Call NameLoad NameLoad body If CompareNotEq Call NameLoad NameLoad NameLoad body If UnaryOpNot NameLoad body Raise Call NameLoad BinOpMod Str TupleLoad NameLoad Call NameLoad NameLoad Call NameLoad NameLoad Raise NameLoad If UnaryOpNot NameLoad body Assign NameStore Call NameLoad NameLoad Return TupleLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam defaults vararg kwarg body Expr Str Assign NameStore ListComp NameLoad comprehension NameStore NameLoad CompareNotEq SubscriptLoad NameLoad Index Num Str Assign NameStore Call NameLoad Lambda arguments args NameParam defaults CompareEq SubscriptLoad SubscriptLoad NameLoad Index NameLoad Slice Num Str Call NameLoad Call NameLoad NameLoad If UnaryOpNot Call AttributeLoad SubscriptLoad NameLoad Index Num attr Str body Expr Call AttributeLoad NameLoad attr Call NameLoad NameLoad Assign NameStore ListLoad Assign NameStore Num For NameStore NameLoad body Assign TupleStore NameStore NameStore Call NameLoad SubscriptLoad NameLoad Slice NameLoad NameLoad NameLoad NameLoad Expr Call AttributeLoad NameLoad attr TupleLoad NameLoad NameLoad Assign NameStore BinOpAdd NameLoad Num Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam defaults Str body Assign NameStore ListLoad For NameStore Call NameLoad Call NameLoad SubscriptLoad NameLoad Index Num body If CompareEq NameLoad NameLoad body Expr Call AttributeLoad NameLoad attr SubscriptLoad SubscriptLoad NameLoad Index Num Index NameLoad orelse Assign NameStore Call NameLoad Lambda arguments args NameParam defaults CompareNotEq NameLoad NameLoad Call NameLoad Lambda arguments args NameParam defaults SubscriptLoad NameLoad Index NameLoad NameLoad If CompareEq Call NameLoad NameLoad Num body Expr Call AttributeLoad NameLoad attr NameLoad orelse Expr Call AttributeLoad NameLoad attr Call NameLoad Call NameLoad Lambda arguments args NameParam defaults SubscriptLoad NameLoad Index NameLoad NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam defaults Num NameLoad Str body Expr Str Expr Call AttributeLoad NameLoad attr Lambda arguments args NameParam NameParam defaults Call NameLoad SubscriptLoad NameLoad Index NameLoad SubscriptLoad NameLoad Index NameLoad Assign NameStore ListLoad Assign NameStore NameLoad Assign NameStore ListLoad For NameStore NameLoad body If CompareNotEq SubscriptLoad NameLoad Index NameLoad NameLoad body If CompareIsNot NameLoad NameLoad body Expr Call AttributeLoad NameLoad attr Call NameLoad NameLoad NameLoad NameLoad NameLoad Assign NameStore ListLoad Assign NameStore SubscriptLoad NameLoad Index NameLoad Expr Call AttributeLoad NameLoad attr NameLoad If CompareIsNot NameLoad NameLoad body Expr Call AttributeLoad NameLoad attr Call NameLoad NameLoad NameLoad NameLoad NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam defaults NameLoad NameLoad body Expr Str Assign NameStore ListLoad For NameStore NameLoad body Assign NameStore NameLoad For NameStore NameLoad body TryExcept body Assign SubscriptStore NameLoad Index NameLoad Call NameLoad SubscriptLoad NameLoad Index NameLoad handlers ExceptHandler type NameLoad name NameStore body If NameLoad body Assign NameStore NameLoad Break orelse Raise Call NameLoad NameLoad If UnaryOpNot NameLoad body Expr Call AttributeLoad NameLoad attr NameLoad Return NameLoad decorator_list
N/A N/A CSV.py - Tools for parsing CSV files
========================================

The methods in this module provide utility functions for
working with :term:`CSV` or :term:`TSV` formatted files.

With pandas providing fast and flexible access to :term:`CSV`
formatted files, most of the functionaly here is now superfluous.

:class:`DictReader` is derived from :py:class:`csv.DictReader`
and adds the capability to skip comment characters.

 N/A types N/A csv getMapColumn2Type N/A N/A rows ignore_empty get_max_values N/A False False N/A N/A map fields to types based on rows.

    Preference is Int to Float to String.

    If get_max_values is set to true, the maximum values for integer
    columns are returned in a dictionary.
     N/A headers N/A N/A N/A rows N/A 0 keys N/A map_column2type N/A N/A is_full N/A N/A max_values N/A N/A row rows N/A N/A h headers N/A N/A N/A N/A row N/A h N/A N/A N/A N/A is_full N/A h True N/A N/A isinstance N/A row N/A h int N/A N/A t N/A types IntType N/A N/A h max_values N/A N/A N/A max_values N/A h N/A int N/A row N/A h N/A N/A N/A max_values N/A h N/A max h N/A int N/A row N/A h N/A N/A N/A isinstance N/A row N/A h float N/A N/A t N/A types FloatType N/A N/A N/A N/A map_column2type N/A h t N/A ignored N/A N/A h headers N/A N/A N/A h map_column2type N/A N/A N/A N/A h is_full N/A ignore_empty N/A N/A N/A map_column2type N/A h N/A types StringType N/A N/A N/A N/A ignored append h N/A get_max_values N/A N/A N/A map_column2type ignored max_values N/A N/A N/A map_column2type ignored N/A CommentStripper N/A N/A N/A Iterator for stripping comments from file.

    This iterator will skip any lines beginning with ``#``
    or any empty lines at the beginning of the output.
     __init__ N/A N/A self infile N/A N/A N/A N/A self infile infile N/A __iter__ N/A N/A self N/A N/A N/A self N/A next N/A N/A self N/A N/A N/A 1 N/A N/A line N/A N/A N/A self infile next N/A N/A line None N/A N/A StopIteration N/A N/A N/A N/A N/A line strip N/A N/A N/A line startswith # N/A N/A line N/A N/A DictReader N/A N/A csv DictReader N/A N/A Like csv.DictReader, but skip lines starting with ``#``.
     __init__ N/A N/A self infile N/A args kwargs N/A N/A N/A N/A N/A csv DictReader __init__ self N/A CommentStripper infile args kwargs N/A N/A UnicodeCsvReader N/A object N/A __init__ N/A N/A self f encoding N/A utf-8 kwargs N/A N/A N/A self csv_reader N/A N/A csv reader f kwargs N/A N/A self encoding encoding N/A __iter__ N/A N/A self N/A N/A N/A self N/A next N/A N/A self N/A N/A N/A row N/A N/A N/A self csv_reader next N/A N/A N/A unicode cell N/A self encoding N/A cell row N/A line_num N/A N/A self N/A N/A N/A N/A N/A self csv_reader line_num N/A property N/A UnicodeDictReader N/A N/A csv DictReader N/A __init__ N/A N/A self f encoding fieldnames N/A utf-8 None kwds N/A N/A N/A N/A N/A csv DictReader __init__ self f fieldnames fieldnames kwds N/A N/A self reader N/A UnicodeCsvReader f encoding encoding kwds N/A N/A DictReaderLarge N/A N/A N/A Substitute for :py:class:`csv.DictReader` that handles very large
    fields.

    :py:mod:`csv` is implemented in C and limits the number of columns
    per table. This class has no such limit, but will not be as fast.

    This class is only a minimal implementation. For example, it does
    not handle dialects.
     __init__ N/A N/A self infile fieldnames N/A args kwargs N/A N/A N/A self mFile infile N/A N/A self mFieldNames fieldnames N/A N/A self mNFields N/A len fieldnames N/A __iter__ N/A N/A self N/A N/A N/A self N/A next N/A N/A self N/A N/A N/A line N/A N/A N/A self mFile next N/A N/A line N/A N/A StopIteration N/A data N/A N/A N/A line N/A -1 split N/A N/A N/A len data N/A self mNFields N/A N/A dict N/A zip N/A self mFieldNames data N/A N/A readTable N/A N/A infile as_rows with_header ignore_incomplete dialect N/A True True False excel-tab N/A N/A read a table from infile

    Arguments
    ---------
    infile : File
       File or list of lines
    as_rows : bool
       If true, return table as a list of rows. Otherwise,
       return as a list of columns.
    ignore_incomplete : bool
       If true, incomplete rows are ignored.
    dialect : string
       CSV dialect.

    Returns
    -------
    fields : list
        List of field names
    rows : list
        List of rows
     N/A lines N/A x N/A x infile N/A N/A x N/A 0 # N/A N/A N/A len lines 0 N/A N/A N/A N/A N/A N/A with_header N/A N/A fields N/A N/A N/A N/A lines N/A 0 N/A -1 split N/A N/A lines N/A 0 N/A N/A fields N/A N/A N/A N/A lines N/A 0 N/A -1 split N/A fields N/A map str N/A range N/A len fields N/A nfields N/A len fields N/A N/A N/A reader N/A N/A csv reader N/A N/A lines __iter__ dialect dialect N/A N/A N/A TypeError N/A N/A reader N/A N/A csv reader N/A N/A lines __iter__ N/A table N/A list reader N/A ignore_incomplete N/A N/A table N/A x N/A x table N/A N/A len x nfields N/A N/A N/A r row N/A enumerate table N/A N/A N/A N/A len row nfields N/A N/A N/A ignore_incomplete N/A N/A N/A ValueError N/A missing elements in line %s, received=%s, expected=%s N/A r N/A str row N/A str fields N/A ValueError N/A N/A as_rows N/A N/A table N/A zip table N/A N/A fields table N/A readTables N/A N/A infile N/A args kwargs N/A N/A read a set of csv tables from a single file.

    Tables within the file should be separated by `//`.

    See :func:`readTable` for additional arguments.

    Arguments
    ---------
    infile : File
       File or list of lines

    Returns
    -------
    tables : list
        A list of tuples (fields, data), one for each table.
     N/A lines N/A x N/A x infile N/A N/A x N/A 0 # N/A chunks N/A filter N/A N/A N/A x N/A N/A N/A N/A lines N/A x N/A 2 // N/A range N/A len lines N/A N/A N/A N/A N/A lines N/A -1 startswith // N/A N/A N/A N/A chunks append N/A len lines N/A result N/A N/A start 0 N/A end chunks N/A N/A N/A fields table N/A readTable N/A lines N/A start end args kwargs N/A N/A N/A result append N/A fields table N/A start N/A end 1 N/A result N/A __DoGroup N/A N/A rows group_column group_function missing_value N/A na N/A N/A values N/A N/A x N/A range N/A len N/A rows N/A 0 N/A N/A N/A x group_column N/A N/A N/A N/A values append N/A N/A rows N/A 0 N/A x N/A N/A v N/A filter N/A N/A N/A x N/A N/A x missing_value N/A map N/A N/A N/A y N/A N/A y N/A x rows N/A N/A N/A len v 0 N/A N/A N/A N/A values append missing_value N/A N/A N/A N/A values append N/A group_function N/A map N/A N/A N/A y N/A N/A y N/A x rows N/A values N/A groupTable N/A N/A table group_column group_function missing_value N/A 0 min na N/A N/A group table by *group_column*.

    The table need not be sorted.
    Arguments
    ---------
    table : list
        List of rows
    group_column : int
        Column to group on
    group_function : function
        Function to apply on grouped values
    missing_value : string
        String to use for missing values.
     N/A N/A N/A table sort N/A N/A N/A x y N/A N/A cmp N/A x N/A group_column N/A y N/A group_column N/A rows N/A N/A last_value None N/A new_table N/A N/A row table N/A N/A N/A N/A row N/A group_column last_value N/A N/A N/A last_value None N/A N/A N/A N/A new_table append N/A __DoGroup rows group_column group_function missing_value N/A rows N/A N/A last_value N/A row N/A group_column N/A N/A N/A rows append row N/A N/A last_value None N/A N/A N/A N/A new_table append N/A __DoGroup rows group_column group_function missing_value N/A new_table N/A convertTable N/A N/A table columns function skip_errors N/A float False N/A N/A convert values in particular columns of a table to a new type.

    Arguments
    ---------
    table : list
        Rows in the table. Each row is a list or tuple.
    columns : list
        Indices of columns to convert
    function : function
        Function to apply for conversion
    skip_errors : bool
        If True, errors are ignored and rows with unconvertible
        values are ignored. The default is to raise a ValueError.

    Returns
    -------
    table : list
        A new table with the converted values.

     N/A new_table N/A N/A row table N/A N/A skip False N/A c columns N/A N/A N/A N/A N/A row N/A c N/A float N/A row N/A c N/A N/A N/A ValueError N/A msg N/A N/A skip_errors N/A N/A skip True N/A N/A N/A N/A ValueError msg N/A N/A skip N/A N/A N/A N/A new_table append row N/A new_table N/A