输入和输出 (scipy.io)#

SciPy 提供了许多模块、类和函数,可用于读取各种文件格式的数据以及将数据写入各种文件格式。

另请参阅

NumPy IO 例程

MATLAB® 文件#

loadmat(file_name[, mdict, appendmat, spmatrix])

加载 MATLAB 文件。

savemat(file_name, mdict[, appendmat, ...])

将名称和数组的字典保存为 MATLAB 风格的 .mat 文件。

whosmat(file_name[, appendmat])

列出 MATLAB 文件中的变量。

有关低级 MATLAB 读写工具,请参阅 scipy.io.matlab

IDL® 文件#

readsav(file_name[, idict, python_dict, ...])

读取 IDL .sav 文件。

Matrix Market 文件#

mminfo(source)

从 Matrix Market 类文件对象 'source' 返回大小和存储参数。

mmread(source, *[, spmatrix])

将 Matrix Market 类文件对象 'source' 的内容读取到矩阵中。

mmwrite(target, a[, comment, field, ...])

将稀疏或密集数组 a 写入 Matrix Market 类文件对象 target

未格式化的 Fortran 文件#

FortranFile(filename[, mode, header_dtype])

用于 Fortran 代码中未格式化顺序文件的文件对象。

FortranEOFError

表示文件正常结束。

FortranFormattingError

表示文件在记录中间结束。

Netcdf#

netcdf_file(filename[, mode, mmap, version, ...])

用于 NetCDF 数据的类文件对象。

netcdf_variable(data, typecode, size, shape, ...)

用于 netcdf 文件的类数据对象。

Harwell-Boeing 文件#

hb_read(path_or_open_file, *[, spmatrix])

读取 HB 格式文件。

hb_write(path_or_open_file, m[, hb_info])

写入 HB 格式文件。

Wav 音频文件 (scipy.io.wavfile)#

read(filename[, mmap])

打开 WAV 文件。

write(filename, rate, data)

将 NumPy 数组写入为 WAV 文件。

WavFileWarning

Arff 文件 (scipy.io.arff)#

loadarff(f)

读取 arff 文件。

MetaData(rel, attr)

一个用于保存 ARFF 数据集有用信息的小型容器。

ArffError

ParseArffError