当前位置: 首页>>代码示例>>Python>>正文


Python pyexcel_io.get_data函数代码示例

本文整理汇总了Python中pyexcel_io.get_data函数的典型用法代码示例。如果您正苦于以下问题:Python get_data函数的具体用法?Python get_data怎么用?Python get_data使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了get_data函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_load_ods_data

def test_load_ods_data():
    msg = "Please install one of these plugins for read data in 'ods': "
    msg += "pyexcel-ods,pyexcel-ods3"
    try:
        get_data("test.ods")
    except manager.SupportingPluginAvailableButNotInstalled as e:
        eq_(str(e), msg)
开发者ID:schulzsebastian,项目名称:qgisplugin_spreadsheet,代码行数:7,代码来源:test_io.py

示例2: test_load_ods_data_from_memory

def test_load_ods_data_from_memory():
    io = BytesIO()
    msg = "Please install one of these plugins for read data in 'ods': "
    msg += "pyexcel-ods,pyexcel-ods3"
    try:
        get_data(io, file_type="ods")
    except manager.SupportingPluginAvailableButNotInstalled as e:
        eq_(str(e), msg)
开发者ID:schulzsebastian,项目名称:qgisplugin_spreadsheet,代码行数:8,代码来源:test_io.py

示例3: get_data

 def get_data(self):
     if self.file_stream is not None:
         sheets = get_data(self.file_stream,
                           file_type=self.file_type,
                           **self.keywords)
     else:
         sheets = get_data(self.file_content,
                           file_type=self.file_type,
                           **self.keywords)
     return one_sheet_tuple(sheets.items())
开发者ID:darylyu,项目名称:pyexcel,代码行数:10,代码来源:memory.py

示例4: test_generator_can_be_written

def test_generator_can_be_written():
    test_filename = "generator.csv"
    test_fixture = os.path.join("tests", "fixtures", "test.csv")
    data = get_data(test_fixture, streaming=True)
    save_data(test_filename, data)
    assert os.path.exists(test_filename)
    data2 = get_data(test_filename)
    expected = get_data(test_fixture)
    assert data2[test_filename] == expected['test.csv']
    os.unlink(test_filename)
开发者ID:jayvdb,项目名称:pyexcel-io,代码行数:10,代码来源:test_io.py

示例5: get_data

 def get_data(self):
     if self.file_stream is not None:
         sheets = get_data(self.file_stream,
                           file_type=self.file_type,
                           streaming=True,
                           **self.keywords)
     else:
         sheets = get_data(self.file_content,
                           file_type=self.file_type,
                           streaming=True,
                           **self.keywords)
     return sheets
开发者ID:62484m,项目名称:QQ-Groups-Spider,代码行数:12,代码来源:file_source_input.py

示例6: test_issue_20

def test_issue_20():
    test_file = os.path.join("tests",
                             "fixtures",
                             "issue20.csv")
    data = get_data(test_file)
    expected = [[u'to', u'infinity', u'and', u'beyond']]
    eq_(data['issue20.csv'], expected)
开发者ID:schulzsebastian,项目名称:qgisplugin_spreadsheet,代码行数:7,代码来源:test_issues.py

示例7: test_pyexcel_issue_138

def test_pyexcel_issue_138():
    array = [["123_122", "123_1.", "123_1.0"]]
    save_data("test.csv", array)
    data = get_data("test.csv")
    expected = [["123_122", "123_1.", "123_1.0"]]
    eq_(data["test.csv"], expected)
    os.unlink("test.csv")
开发者ID:pyexcel,项目名称:pyexcel-io,代码行数:7,代码来源:test_issues.py

示例8: get_data

 def get_data(self):
     exporter = DjangoModelExporter()
     for model in self.models:
         adapter = DjangoModelExportAdapter(model)
         exporter.append(adapter)
     data = get_data(exporter, file_type=DB_DJANGO, **self.keywords)
     return data
开发者ID:Gayathri001,项目名称:cir-portal,代码行数:7,代码来源:database.py

示例9: usufyToTextExport

def usufyToTextExport(d, fPath=None):
    '''
        Workaround to export to a .txt file.
        :param d: Data to export.
        :param fPath: File path. If None was provided, it will assume that it has to print it.
    '''
    import pyexcel as pe
    import pyexcel.ext.text as text    

    if fPath == None:
        isTerminal = True
    else:
        isTerminal = False
        
    try:
        oldData = get_data(fPath)
    except:
        # No information has been recovered
        oldData = {"OSRFramework":[]}

    # Generating the new tabular data
    tabularData = _generateTabularData(d, {"OSRFramework":[[]]}, True, canUnicode=False)
    # The tabular data contains a dict representing the whole book and we need only the sheet!!
    sheet = pe.Sheet(tabularData["OSRFramework"])
    sheet.name = "Profiles recovered (" + getCurrentStrDatetime() +")."
    # Defining the headers
    sheet.name_columns_by_row(0)
    text.TABLEFMT = "grid" 
    try:
        with open(fPath, "w") as oF:
            oF.write(str(sheet))
    except:
        # If a fPath was not provided... We will only print the info:
        return sheet    
开发者ID:p4tria,项目名称:osrframework,代码行数:34,代码来源:general.py

示例10: test_filter_both_ways_2

 def test_filter_both_ways_2(self):
     filtered_data = get_data(self.test_file,
                              start_column=1, column_limit=1,
                              start_row=3, row_limit=1,
                              library="pyexcel-ods")
     expected = [[24]]
     eq_(filtered_data[self.sheet_name], expected)
开发者ID:schulzsebastian,项目名称:qgisplugin_spreadsheet,代码行数:7,代码来源:test_filter.py

示例11: test_issue_8

def test_issue_8():
    test_file = "test_issue_8.csv"
    data = [[1, 2], [], [], [], [3, 4]]
    save_data(test_file, data)
    written_data = get_data(test_file, skip_empty_rows=False)
    eq_(data, written_data[test_file])
    os.unlink(test_file)
开发者ID:pyexcel,项目名称:pyexcel-io,代码行数:7,代码来源:test_issues.py

示例12: test_filter_row

    def test_filter_row(self):

        def custom_row_renderer(row):
            return [str(element) for element in row]
        custom_data = get_data(self.test_file,
                               row_renderer=custom_row_renderer)
        expected = [['1', '21', '31'], ['2', '22', '32']]
        eq_(custom_data[self.test_file], expected)
开发者ID:schulzsebastian,项目名称:qgisplugin_spreadsheet,代码行数:8,代码来源:test_renderer.py

示例13: test_file_handle_as_input

def test_file_handle_as_input():
    test_file = "file_handle.csv"
    with open(test_file, 'w') as f:
        f.write("1,2,3")

    with open(test_file, 'r') as f:
        data = get_data(f, 'csv')
        eq_(data['csv'], [[1, 2, 3]])
开发者ID:schulzsebastian,项目名称:qgisplugin_spreadsheet,代码行数:8,代码来源:test_io.py

示例14: test_conversion_from_bytes_to_text

def test_conversion_from_bytes_to_text():
    data = [['1','2','3']]
    save_data("conversion.csv", data)
    with open("conversion.csv", "rb") as f:
        content = f.read()
        result = get_data(content, 'csv')
        assert result == data
    os.unlink("conversion.csv")
开发者ID:fuhrysteve,项目名称:pyexcel-io,代码行数:8,代码来源:test_io.py

示例15: test_file_type_case_insensitivity

def test_file_type_case_insensitivity():
    test_file = "file_handle.CSv"
    with open(test_file, 'w') as f:
        f.write("1,2,3")

    with open(test_file, 'r') as f:
        data = get_data(f, 'csv')
        eq_(data['csv'], [[1, 2, 3]])
开发者ID:schulzsebastian,项目名称:qgisplugin_spreadsheet,代码行数:8,代码来源:test_io.py


注:本文中的pyexcel_io.get_data函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。