Skip to content

Latest commit

 

History

History
55 lines (31 loc) · 1.36 KB

io.rst

File metadata and controls

55 lines (31 loc) · 1.36 KB

Input and Output

nextorch.io

NEXTorch can read data from CSV or Excel files. It can output the same format.

IO functions that interfaces with CSV or Excel are built on pandas. The data are first read in as pandas.DataFrame. They are then converted to numpy.ndarray, passed to Experiment classes and used for plotting.

Examples

Specify the X and Y variable names in X_names and Y_names as Python lists. Read the data from a CSV file.

from nextorch import io

var_names = X_names + Y_names
data, data_full = read_csv(file_path, var_names = var_names)
X_real, Y_real, _, _ = io.split_X_y(data, Y_names = Y_names)

Convert the output data from a numpy.ndarray to a pandas.DataFrame and then export it to a CSV file.

from nextorch import io

data = io.np_to_dataframe([X, Y], var_names)
data.to_csv('test_data.csv')

Here is a list of IO functions in nextorch.io module.

np_to_dataframe read_csv read_excel split_X_y