afmslicer.io
¶
Input/Output related functions.
dict_to_df(data)
¶
Convert a nested dictionary to a dataframe.
Layers of pore statistics are converted to a dataframe.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
dict[int | str, Any]
|
Nested dictionary to be converted. |
required |
Returns:
| Type | Description |
|---|---|
DataFrame
|
Pandas dataframe of statistics. |
Source code in src/afmslicer/io.py
write_csv(df, outdir='output', filename='results.csv', index=False)
¶
Write a dataframe to .csv file in output directory.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
df
|
DataFrame
|
Pandas dataframe to write to disk. |
required |
outdir
|
Path | str
|
Path where file is to be written. |
'output'
|
filename
|
str
|
Filename for output, defaults to |
'results.csv'
|
index
|
bool
|
Whether to include the index or not. |
False
|