Pandas read_table() function
Pandas is one of the most used packages for analyzing data, data exploration, and manipulation. While analyzing the real-world data, we often use the URLs to perform different operations and pandas provide multiple methods to do so. One of those methods is read_table().
read_table(filepath_or_buffer, sep=False, delimiter=None, header=’infer’, names=None, index_col=None, usecols=None, squeeze=False, prefix=None, mangle_dupe_cols=True, dtype=None, engine=None, converters=None, true_values=None, false_values=None, skipinitialspace=False, skiprows=None, skipfooter=0, nrows=None, na_values=None, keep_default_na=True, na_filter=True, verbose=False, skip_blank_lines=True, parse_dates=False, infer_datetime_format=False, keep_date_col=False, date_parser=None, dayfirst=False, iterator=False, chunksize=None, compression=’infer’, thousands=None, decimal=b’.’, lineterminator=None, quotechar='”‘, quoting=0, doublequote=True, escapechar=None, comment=None, encoding=None, dialect=None, tupleize_cols=None, error_bad_lines=True, warn_bad_lines=True, delim_whitespace=False, low_memory=True, memory_map=False, float_precision=None)
Returns: A comma(‘,’) separated values file(csv) is returned as two dimensional data with labelled axes.
To get the link to csv file used in the article, click here.
Code #1: Display the whole content of the file with columns separated by ‘,’
Code #2: Skipping rows without indexing
In the above code, four rows are skipped and the last skipped row is displayed.
Code #3: Skipping rows with indexing
Code #4: In case of large file, if you want to read only few lines then give required number of lines to nrows.
Code #5: If you want to skip lines from bottom of file then give required number of lines to skipfooter.
Code #6: Row number(s) to use as the column names, and the start of the data occurs after the last row number given in header.