fixed
and geojson
loaders are at https://github.com/wireservice/csvkit/tree/master/csvkit/convert
csvkit
/agate
)
for geojson support, pyexcel needs one more abstraction on top of existing book, sheet.
I really like the csvkit geojson importer. I want to serialise the schema into a non-schema format, and it does that. It simply puts any complex values into columns as JSON blobs. This lets me work with the non-complex fields easily, and I can reconstruct the geojson afterwards. (after my patches are merged : wireservice/csvkit#868 )
commons/
as a sym link to ../pyexcel-commons
skip_empty_rows
does not work for me because the first column has a default value. I see we can pass in a custom skip_row_func
my idea is to skip a row if key column values are empty, my question is what does skip_row_func
have access to? meaning, do I reference columns by name? thank you.
import pyexcel as p
def filter_out(generator):
for row in generator:
if row[0] == 'what I do not want':
pass
else:
yield row
data_generator = p.iget_array(
file_name="your_file.csv"
)
p.isave_as(
array=filter_out(data_generator),
dest_file_name="my_filtered.csv"
)
Traceback (most recent call last):
File "test.py", line 3, in <module>
book = pyexcel.get_book(file_stream=f, file_type="xlsx")
File "/home/azucaro/tmp/new-pyexcel/lib/python2.7/site-packages/pyexcel/core.py", line 46, in get_book
book_stream = sources.get_book_stream(**keywords)
File "/home/azucaro/tmp/new-pyexcel/lib/python2.7/site-packages/pyexcel/internal/core.py", line 33, in get_book_stream
sheets = a_source.get_data()
File "/home/azucaro/tmp/new-pyexcel/lib/python2.7/site-packages/pyexcel/plugins/sources/memory_input.py", line 34, in get_data
**self._keywords)
File "/home/azucaro/tmp/new-pyexcel/lib/python2.7/site-packages/pyexcel/plugins/parsers/excel.py", line 21, in parse_file_stream
file_stream, file_type=self._file_type, **keywords)
File "/home/azucaro/tmp/new-pyexcel/lib/python2.7/site-packages/pyexcel/plugins/parsers/excel.py", line 35, in _parse_any
anything, file_type=file_type, **keywords)
File "/home/azucaro/tmp/new-pyexcel/lib/python2.7/site-packages/pyexcel_io/io.py", line 71, in get_data
afile, file_type=file_type, streaming=False, **keywords
File "/home/azucaro/tmp/new-pyexcel/lib/python2.7/site-packages/pyexcel_io/io.py", line 89, in _get_data
return load_data(**keywords)
File "/home/azucaro/tmp/new-pyexcel/lib/python2.7/site-packages/pyexcel_io/io.py", line 191, in load_data
reader.open_stream(file_stream, **keywords)
File "/home/azucaro/tmp/new-pyexcel/lib/python2.7/site-packages/pyexcel_xlsx/xlsxr.py", line 146, in open_stream
self._load_the_excel_file(file_stream)
File "/home/azucaro/tmp/new-pyexcel/lib/python2.7/site-packages/pyexcel_xlsx/xlsxr.py", line 194, in _load_the_excel_file
read_only=read_only_flag)
File "/home/azucaro/tmp/new-pyexcel/lib/python2.7/site-packages/openpyxl/reader/excel.py", line 249, in load_workbook
ws_parser.parse()
File "/home/azucaro/tmp/new-pyexcel/lib/python2.7/site-packages/openpyxl/reader/worksheet.py", line 130, in parse
dispatcher[tag_name](element)
File "/home/azucaro/tmp/new-pyexcel/lib/python2.7/site-packages/openpyxl/reader/worksheet.py", line 296, in parser_conditional_formatting
cf = ConditionalFormatting.from_tree(element)
File "/home/azucaro/tmp/new-pyexcel/lib/python2.7/site-packages/openpyxl/descriptors/serialisable.py", line 100, in from_tree
return cls(**attrib)
File "/home/azucaro/tmp/new-pyexcel/lib/python2.7/site-packages/openpyxl/formatting/formatting.py", line 33, in __init__
self.sqref = sqref
File "/home/azucaro/tmp/new-pyexcel/lib/python2.7/site-packages/openpyxl/descriptors/base.py", line 69, in __set__
value = _convert(self.expected_type, value)
File "/home/azucaro/tmp/new-pyexcel/lib/python2.7/site-packages/openpyxl/descriptors/base.py", line 59, in _convert
raise TypeError('expected ' + str(expected_type))
TypeError: expected <class 'openpyxl.worksheet.cell_range.MultiCellRange'>