Generate
generate_code(file_path, file_name, extension, sep=None, prefix='df_')
This function returns generated python code to load the files to memory using pandas.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
file_path
|
str
|
Folder to read the file. |
required |
file_name
|
str
|
File name. |
required |
extension
|
str
|
Extension of the file. |
required |
sep
|
str | None
|
Separator used in the plain file. Defaults to None. |
None
|
prefix
|
str
|
Prefix to name the dataframes. Defaults to "df_". |
'df_'
|
Source code in src/afes/generate.py
generate_pandas_code(df, verbose=True, python_file='code.txt')
This functions receives the dataframe generated by explore()
and
generates pandas code to read each file.
It writes a code.txt
file with the scripts.
The verbose option is to print the code to the standard output.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
df
|
DataFrame
|
DataFrame with description of the files. |
required |
verbose
|
bool
|
[Optional (default: True)] flag to print in the shell the code generated. |
True
|
python_file
|
str
|
[Optional (default: "code.txt")] File name for output of the code generated. |
'code.txt'
|