MCPcopy Create free account
hub / github.com/EntilZha/PyFunctional / csv_dict_reader

Method csv_dict_reader

functional/streams.py:163–190  ·  view source on GitHub ↗
(
        self,
        csv_file,
        fieldnames=None,
        restkey=None,
        restval=None,
        dialect="excel",
        **kwds
    )

Source from the content-addressed store, hash-verified

161 return self(csv_input).cache(delete_lineage=True)
162
163 def csv_dict_reader(
164 self,
165 csv_file,
166 fieldnames=None,
167 restkey=None,
168 restval=None,
169 dialect="excel",
170 **kwds
171 ):
172 if isinstance(csv_file, str):
173 file_open = get_read_function(csv_file, self.disable_compression)
174 input_file = file_open(csv_file)
175 elif hasattr(csv_file, "next") or hasattr(csv_file, "__next__"):
176 input_file = csv_file
177 else:
178 raise ValueError(
179 "csv_file must be a file path or implement the iterator interface"
180 )
181
182 csv_input = csvapi.DictReader(
183 input_file,
184 fieldnames=fieldnames,
185 restkey=restkey,
186 restval=restval,
187 dialect=dialect,
188 **kwds
189 )
190 return self(csv_input).cache(delete_lineage=True)
191
192 def jsonl(self, jsonl_file):
193 """

Callers 1

test_csv_dict_readerMethod · 0.80

Calls 2

get_read_functionFunction · 0.90
cacheMethod · 0.80

Tested by 1

test_csv_dict_readerMethod · 0.64