Icon

kn_​forum_​1782_​dbf_​import_​dbase_​file_​r

Import DBF (dBase) file with the help of R's foreign library or Python packages

Import DBF (dBase) file with the help of R's foreign library or Python packages

Import DBF (dBase) file with the help of R's foreign library or Python packageshttps://forum.knime.com/t/dbf-file-reading/1782/2 library(foreign)knime.out <- read.dbf(knime.flow.in[["v_import_file"]]) import knime.scripting.io as knioimport numpy as npimport pandas as pdfrom dbfread import DBF# Define the file path and name of the dBASE dbf filefile_path = knio.flow_variables['v_import_file']# Use the DBF function from dbfread to read the filetable = DBF(file_path)# Convert the table to a pandas DataFramedf = pd.DataFrame(iter(table))# Display the first 5 rows of the DataFrameprint(df.head())knio.output_tables[0] = knio.Table.from_pandas(df) import knime.scripting.io as knioimport numpy as npimport pandas as pdfrom simpledbf import Dbf5# Define the file path and name of the dBASE dbf filefile_path = knio.flow_variables['v_import_file']# Use the Dbf5 function from simpledbf to read the filedbf = Dbf5(file_path)# Convert the data to a pandas DataFramedf = dbf.to_dataframe()# Display the first 5 rows of the DataFrameprint(df.head())knio.output_tables[0] = knio.Table.from_pandas(df) locate and create/data/ folderwith absolute pathsget dbf=> does not workmabye DBF file brokenv_import_file/data/example.dbfjust initiate Rv_import_file/data/example_file.dbfwrite dbfget dbflibrary(foreign)knime.out <- read.dbf(knime.flow.in[["v_import_file"]])just initiate Rdbfread2 columns missing ??py3_knimedbfreadsimpledbfmanually exportto DBF with Libre OfficeCollect LocalMetadata R Snippet Java EditVariable (simple) R Source (Table) Data Generator Java EditVariable (simple) R Snippet R Snippet R Source (Table) Python Script Conda EnvironmentPropagation Merge Variables Merge Variables Python Script Python Script Create Sample Data Import DBF (dBase) file with the help of R's foreign library or Python packageshttps://forum.knime.com/t/dbf-file-reading/1782/2 library(foreign)knime.out <- read.dbf(knime.flow.in[["v_import_file"]]) import knime.scripting.io as knioimport numpy as npimport pandas as pdfrom dbfread import DBF# Define the file path and name of the dBASE dbf filefile_path = knio.flow_variables['v_import_file']# Use the DBF function from dbfread to read the filetable = DBF(file_path)# Convert the table to a pandas DataFramedf = pd.DataFrame(iter(table))# Display the first 5 rows of the DataFrameprint(df.head())knio.output_tables[0] = knio.Table.from_pandas(df) import knime.scripting.io as knioimport numpy as npimport pandas as pdfrom simpledbf import Dbf5# Define the file path and name of the dBASE dbf filefile_path = knio.flow_variables['v_import_file']# Use the Dbf5 function from simpledbf to read the filedbf = Dbf5(file_path)# Convert the data to a pandas DataFramedf = dbf.to_dataframe()# Display the first 5 rows of the DataFrameprint(df.head())knio.output_tables[0] = knio.Table.from_pandas(df) locate and create/data/ folderwith absolute pathsget dbf=> does not workmabye DBF file brokenv_import_file/data/example.dbfjust initiate Rv_import_file/data/example_file.dbfwrite dbfget dbflibrary(foreign)knime.out <- read.dbf(knime.flow.in[["v_import_file"]])just initiate Rdbfread2 columns missing ??py3_knimedbfreadsimpledbfmanually exportto DBF with Libre OfficeCollect LocalMetadata R Snippet Java EditVariable (simple) R Source (Table) Data Generator Java EditVariable (simple) R Snippet R Snippet R Source (Table) Python Script Conda EnvironmentPropagation Merge Variables Merge Variables Python Script Python Script Create Sample Data

Nodes

Extensions

Links