unitorch.cli.writer¤
GeneralCsvWriter¤
Tip
core/writer/csv
is the section for configuration of GeneralCsvWriter.
Bases: GenericWriter
Class for writing data in CSV format.
Initialize GeneralCsvWriter.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
output_file |
str
|
The path to the output file. |
required |
nrows_per_sample |
int
|
The number of rows per sample. Defaults to None. |
None
|
header |
bool
|
Whether to include a header in the output file. Defaults to None. |
None
|
columns |
List[str]
|
The list of columns to include in the output file. Defaults to None. |
None
|
sep |
str
|
The separator for the CSV file. Defaults to " ". |
'\t'
|
quoting |
int
|
The quoting style for the CSV file. Defaults to 3. |
3
|
escapechar |
str
|
The escape character for the CSV file. Defaults to None. |
None
|
Source code in src/unitorch/cli/writers/__init__.py
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 |
|
from_core_configure
classmethod
¤
from_core_configure(config, **kwargs)
Create an instance of GeneralCsvWriter from a core configuration.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
config |
The core configuration. |
required | |
**kwargs |
Additional keyword arguments. |
{}
|
Returns:
Name | Type | Description |
---|---|---|
GeneralCsvWriter |
An instance of GeneralCsvWriter. |
Source code in src/unitorch/cli/writers/__init__.py
159 160 161 162 163 164 165 166 167 168 169 170 171 172 |
|
process_chunk ¤
process_chunk(outputs: WriterOutputs)
Process a chunk of data during the writing process.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
outputs |
WriterOutputs
|
The writer outputs. |
required |
Source code in src/unitorch/cli/writers/__init__.py
199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 |
|
process_end ¤
process_end()
Process the end of the writing process.
Source code in src/unitorch/cli/writers/__init__.py
195 196 197 |
|
process_start ¤
process_start(outputs: WriterOutputs)
Process the start of the writing process.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
outputs |
WriterOutputs
|
The writer outputs. |
required |
Source code in src/unitorch/cli/writers/__init__.py
174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 |
|