pyarrow.LocalFileSystem

class pyarrow.LocalFileSystem[source]

Bases: pyarrow.filesystem.FileSystem

__init__()[source]

Methods

__init__()

cat(path)

Return contents of file as a bytes object.

delete(path[, recursive])

Delete the indicated file or directory.

disk_usage(path)

Compute bytes used by all contents under indicated path in file tree.

exists(path)

Return True if path exists.

get_instance()

isdir(path)

Return True if path is a directory.

isfile(path)

Return True if path is a file.

ls(path)

Return list of file paths.

mkdir(path[, create_parents])

Create a directory.

mv(path, new_path)

Alias for FileSystem.rename.

open(path[, mode])

Open file for reading or writing.

read_parquet(path[, columns, metadata, ...])

Read Parquet data from path in file system.

rename(path, new_path)

Rename file, like UNIX mv command.

rm(path[, recursive])

Alias for FileSystem.delete.

stat(path)

Information about a filesystem entry.

walk(path)

Directory tree generator, see os.walk.

Attributes

pathsep

cat(path)

Return contents of file as a bytes object.

Parameters
pathstr

File path to read content from.

Returns
contentsbytes
delete(path, recursive=False)

Delete the indicated file or directory.

Parameters
pathstr

Path to delete.

recursivebool, default False

If True, also delete child paths for directories.

disk_usage(path)

Compute bytes used by all contents under indicated path in file tree.

Parameters
pathstr

Can be a file path or directory.

Returns
usageint
exists(path)[source]

Return True if path exists.

Parameters
pathstr

Path to check.

classmethod get_instance()[source]
isdir(path)[source]

Return True if path is a directory.

Parameters
pathstr

Path to check.

isfile(path)[source]

Return True if path is a file.

Parameters
pathstr

Path to check.

ls(path)[source]

Return list of file paths.

Parameters
pathstr

Directory to list contents from.

mkdir(path, create_parents=True)[source]

Create a directory.

Parameters
pathstr

Path to the directory.

create_parentsbool, default True

If the parent directories don’t exists create them as well.

mv(path, new_path)

Alias for FileSystem.rename.

open(path, mode='rb')[source]

Open file for reading or writing.

property pathsep
read_parquet(path, columns=None, metadata=None, schema=None, use_threads=True, use_pandas_metadata=False)

Read Parquet data from path in file system. Can read from a single file or a directory of files.

Parameters
pathstr

Single file path or directory

columnsList[str], optional

Subset of columns to read.

metadatapyarrow.parquet.FileMetaData

Known metadata to validate files against.

schemapyarrow.parquet.Schema

Known schema to validate files against. Alternative to metadata argument.

use_threadsbool, default True

Perform multi-threaded column reads.

use_pandas_metadatabool, default False

If True and file has custom pandas schema metadata, ensure that index columns are also loaded.

Returns
tablepyarrow.Table
rename(path, new_path)

Rename file, like UNIX mv command.

Parameters
pathstr

Path to alter.

new_pathstr

Path to move to.

rm(path, recursive=False)

Alias for FileSystem.delete.

stat(path)

Information about a filesystem entry.

Returns
statdict
walk(path)[source]

Directory tree generator, see os.walk.