Package: pytablereader
pytablereaderSummaryFeaturesExamplesLoad a CSV tableGet loaded table data as pandas.DataFrame instanceFor more informationInstallationInstall from PyPIInstall from PPA (for Ubuntu)DependenciesOptional Python packagesOptional packages (other than Python packages)DocumentationRelated ProjectSponsorsSummarypytablereaderis a Python library to load structured table data from files/strings/URL with various data format: CSV / Excel / Google-Sheets / HTML / JSON / LDJSON / LTSV / Markdown / SQLite / TSV.FeaturesExtract structured tabular data from various data format:CSV / Tab separated values (TSV) / Space separated values (SSV)Microsoft ExcelTMfileGoogle SheetsHTML (tabletags)JSONLabeled Tab-separated Values (LTSV)Line-delimited JSON(LDJSON)/ NDJSON / JSON LinesMarkdownMediaWikiSQLite database fileSupported data sources are:Files on a local file systemAccessible URLsstrinstancesLoaded table data can be used as:pandas.DataFrameinstancedictinstanceExamplesLoad a CSV tableSample Code:importpytablereaderasptrimportpytablewriterasptw# prepare data ---file_path="sample_data.csv"csv_text="\n".join(['"attr_a","attr_b","attr_c"','1,4,"a"','2,2.1,"bb"','3,120.9,"ccc"',])withopen(file_path,"w")asf:f.write(csv_text)# load from a csv file ---loader=ptr.CsvTableFileLoader(file_path)fortable_datainloader.load():print("\n".join(["load from file","==============","{:s}".format(ptw.dumps_tabledata(table_data)),]))# load from a csv text ---loader=ptr.CsvTableTextLoader(csv_text)fortable_datainloader.load():print("\n".join(["load from text","==============","{:s}".format(ptw.dumps_tabledata(table_data)),]))Output:load from file
==============
.. table:: sample_data

    ======  ======  ======
    attr_a  attr_b  attr_c
    ======  ======  ======
         1     4.0  a
         2     2.1  bb
         3   120.9  ccc
    ======  ======  ======

load from text
==============
.. table:: csv2

    ======  ======  ======
    attr_a  attr_b  attr_c
    ======  ======  ======
         1     4.0  a
         2     2.1  bb
         3   120.9  ccc
    ======  ======  ======Get loaded table data as pandas.DataFrame instanceSample Code:importpytablereaderasptrloader=ptr.CsvTableTextLoader("\n".join(["a,b","1,2","3.3,4.4",]))fortable_datainloader.load():print(table_data.as_dataframe())Output:a    b
0    1    2
1  3.3  4.4For more informationMore examples are available athttps://pytablereader.rtfd.io/en/latest/pages/examples/index.htmlInstallationInstall from PyPIpip install pytablereaderSome of the formats require additional dependency packages, you can install the dependency packages as follows:Excelpip install pytablereader[excel]Google Sheetspip install pytablereader[gs]Markdownpip install pytablereader[md]Mediawikipip install pytablereader[mediawiki]SQLitepip install pytablereader[sqlite]Load from URLspip install pytablereader[url]All of the extra dependenciespip install pytablereader[all]Install from PPA (for Ubuntu)sudo add-apt-repository ppa:thombashi/ppa
sudo apt update
sudo apt install python3-pytablereaderDependenciesPython 3.7+Python package dependencies (automatically installed)Optional Python packagesloggingextrasloguru: Used for logging if the package installedexcelextrasexcelrdmdextrasMarkdownmediawikiextraspypandocsqliteextrasSimpleSQLiteurlextrasretryrequestspandasrequired to get table data as a pandas data framelxmlOptional packages (other than Python packages)libxml2(faster HTML conversion)pandoc(required when loading MediaWiki file)Documentationhttps://pytablereader.rtfd.io/Related ProjectpytablewriterTabular data loaded bypytablereadercan be written another tabular data format withpytablewriter.SponsorsBecome a sponsor