Path Functions
Functions for working with file paths and extracting path components.
path
file_ext
Returns the extension of the given path.
Parameters:
-
col
(str | Column | Func | literal
) βString to compute the file extension of. If a string is provided, it is assumed to be the name of the column. If a Column is provided, it is assumed to be a column object. If a Func is provided, it is assumed to be a function returning a string. If a literal is provided, it is assumed to be a string literal.
Returns:
-
Func
(Func
) βA
Func
object that represents the file extension function.
Example
Note
- The result column will always be of type string.
Source code in datachain/func/path.py
file_stem
Returns the path without the extension.
Parameters:
-
col
(str | Column | Func | literal
) βString to compute the file stem of. If a string is provided, it is assumed to be the name of the column. If a Column is provided, it is assumed to be a column object. If a Func is provided, it is assumed to be a function returning a string. If a literal is provided, it is assumed to be a string literal.
Returns:
-
Func
(Func
) βA
Func
object that represents the file stem function.
Example
Note
- The result column will always be of type string.
Source code in datachain/func/path.py
name
Returns the final component of a posix-style path.
Parameters:
-
col
(str | Column | Func | literal
) βString to compute the path name of. If a string is provided, it is assumed to be the name of the column. If a Column is provided, it is assumed to be a column object. If a Func is provided, it is assumed to be a function returning a string. If a literal is provided, it is assumed to be a string literal.
Returns:
-
Func
(Func
) βA
Func
object that represents the path name function.
Example
Note
- The result column will always be of type string.
Source code in datachain/func/path.py
parent
Returns the directory component of a posix-style path.
Parameters:
-
col
(str | Column | Func | literal
) βString to compute the path parent of. If a string is provided, it is assumed to be the name of the column. If a Column is provided, it is assumed to be a column object. If a Func is provided, it is assumed to be a function returning a string. If a literal is provided, it is assumed to be a string literal.
Returns:
-
Func
(Func
) βA
Func
object that represents the path parent function.
Example
Note
- The result column will always be of type string.