FolderMixin¶
- class pydelfini.collections.FolderMixin(collection, full_path, core)[source]¶
Bases:
ABC
Folder interaction methods as a mixin class.
This class is used by
DelfiniCollection
andDelfiniFolder
.Attributes
id
path
- Parameters:
collection (DelfiniCollection)
full_path (str | None)
core (AuthenticatedClient)
- __getitem__(item_path)[source]¶
Retrieve an item in this folder.
Relative paths are supported, such as
folder_a/folder_b/item_c
.- Parameters:
item_path (str)
- Return type:
- folder(folder_name)[source]¶
Open the named folder.
- Parameters:
folder_name (str) – the name of the folder to open
- Return type:
- new_empty_file(file_name)[source]¶
Create a new, empty file.
- Parameters:
file_name (str) – the name of the file to create
- Return type:
- new_folder(folder_name)[source]¶
Create a new folder.
- Parameters:
folder_name (str) – the name of the folder to create
- Return type:
- new_link(target, link_name=None)[source]¶
Create a new link pointing to a target.
- Parameters:
- Return type:
- write_table(item_path, dataframe, format='csv', **kwargs)[source]¶
Write a
pd.DataFrame
to the named item.- Parameters:
item_path (str) – The path to the item relative to the current folder. Accepts slashes (‘/’) for items in subfolders.
dataframe (DataFrame) – The dataframe to be written.
format (Literal['csv', 'parquet']) – One of the supported formats (
csv
orparquet
).**kwargs (Any) – Any other arguments to be passed to the Pandas export function. See the documentation for
pd.DataFrame.to_csv()
orpd.DataFrame.to_parquet()
for valid arguments.
- Return type:
None