• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python pyexcel.save_as函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: save_to_database

 def save_to_database(
         self,
         session=None, table=None, initializer=None, mapdict=None,
         auto_commit=True,
         **keywords):
     """
     Save data from a sheet to database
     
     :param session: a SQLAlchemy session						
     :param table: a database table 
     :param initializer: a custom table initialization function if you have one
     :param mapdict: the explicit table column names if your excel data do not have the exact column names
     :param keywords: additional keywords to :meth:`pyexcel.Sheet.save_to_database`
     """
     params = self.get_params(**keywords)
     if 'name_columns_by_row' not in params:
         params['name_columns_by_row'] = 0
     if 'name_rows_by_column' not in params:
         params['name_rows_by_column'] = -1
     params['dest_session']=session
     params['dest_table'] = table
     params['dest_initializer']=initializer
     params['dest_mapdict'] = mapdict
     params['dest_auto_commit']=auto_commit
     pe.save_as(**params)
开发者ID:CometHale,项目名称:AMS30,代码行数:25,代码来源:__init__.py


示例2: create_sample_file1

def create_sample_file1(file):
    data = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", 1.1, 1]
    table = []
    table.append(data[:4])
    table.append(data[4:8])
    table.append(data[8:12])
    pyexcel.save_as(array=table, dest_file_name=file)
开发者ID:pyexcel,项目名称:pyexcel-ods3,代码行数:7,代码来源:base.py


示例3: create_sample_file1

def create_sample_file1(file):
    data = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 1.1, 1]
    table = []
    table.append(data[:4])
    table.append(data[4:8])
    table.append(data[8:12])
    pyexcel.save_as(dest_file_name=file, array=table)
开发者ID:gamer-007,项目名称:pyexcel-xls,代码行数:7,代码来源:base.py


示例4: setUp

    def setUp(self):
        """
        Make a test csv file as:

        1, 2, 3, 4
        5, 6, 7, 8
        9, 10, 11, 12
        """
        self.testfile1 = "testcsv1.csv"
        content = [
            [1, 'a'],
            [2, 'b'],
            [3, 'c'],
            [4, 'd'],
            [5, 'e'],
            [6, 'f'],
            [7, 'g'],
            [8, 'h']
        ]
        pe.save_as(dest_file_name=self.testfile1,
                   array=content)
        self.testfile2 = "testcsv2.csv"
        content = [
            [1, 'a', 'c'],
            [2, 'b', 'h'],
            [3, 'c', 'c'],
            [8, 'h', 'd']
        ]
        pe.save_as(dest_file_name=self.testfile2,
                   array=content)
开发者ID:CHEN-JIANGHANG,项目名称:pyexcel,代码行数:30,代码来源:test_filter.py


示例5: test_writing_multiline_ods

def test_writing_multiline_ods():
    content = "2\n3\n4\n993939\na"
    testfile = "writemultiline.ods"
    array = [[content, "test"]]
    pyexcel.save_as(array=array, dest_file_name=testfile)
    sheet = pyexcel.get_sheet(file_name=testfile)
    assert sheet[0, 0] == content
    os.unlink(testfile)
开发者ID:schulzsebastian,项目名称:qgisplugin_spreadsheet,代码行数:8,代码来源:test_multiline_feature.py


示例6: setUp

 def setUp(self):
     self.data = {
         "1": [1, 2, 3, 4, 5, 6, 7, 8],
         "3": [1.1, 2.2, 3.3, 4.4, 5.5, 6.6, 7.7, 8.8],
         "5": [2, 3, 4, 5, 6, 7, 8, 9],
     }
     self.testfile = "test.xls"
     pe.save_as(dest_file_name=self.testfile, adict=self.data)
开发者ID:ChiangFamily,项目名称:pyexcel,代码行数:8,代码来源:test_formatters.py


示例7: setUp

 def setUp(self):
     self.excel_filename = "testdateformat.csv"
     self.data = [[
         datetime.date(2014,12,25),
         datetime.datetime(2014,12,25,11,11,11),
         datetime.datetime(2014,12,25,11,11,11,10)
     ]]
     pe.save_as(dest_file_name=self.excel_filename, array=self.data)
开发者ID:jayvdb,项目名称:pyexcel-io,代码行数:8,代码来源:test_pyexcel_integration.py


示例8: test_new_normal_usage_irregular_columns

    def test_new_normal_usage_irregular_columns(self):
        content = [
            [1, 2, 3],
            [4, 588, 6],
            [7, 8]
        ]
        pe.save_as(array=content, dest_file_name=self.testfile)

        self._check_test_file('new_normal_usage_irregular_columns')
开发者ID:jayvdb,项目名称:pyexcel-text,代码行数:9,代码来源:test_io.py


示例9: test_no_title_single_sheet

    def test_no_title_single_sheet(self):
        content = [
            [1, 2, 3],
            [4, 588, 6],
            [7, 8, 999]
        ]
        pe.save_as(array=content, dest_file_name=self.testfile, dest_write_title=False)

        self._check_test_file('no_title_single_sheet')
开发者ID:jayvdb,项目名称:pyexcel-text,代码行数:9,代码来源:test_io.py


示例10: test_new_normal_usage

    def test_new_normal_usage(self):
        content = [
            [1, 2, 3],
            [4, 588, 6],
            [7, 8, 999]
        ]
        pe.save_as(array=content, dest_file_name=self.testfile)

        self._check_test_file('new_normal_usage')
开发者ID:jayvdb,项目名称:pyexcel-text,代码行数:9,代码来源:test_io.py


示例11: test_issue_10

 def test_issue_10(self):
     thedict = OrderedDict()
     thedict.update({"Column 1": [1,2,3]})
     thedict.update({"Column 2": [1,2,3]})
     thedict.update({"Column 3": [1,2,3]})
     pe.save_as(adict=thedict, dest_file_name="issue10.xls")
     newdict = pe.get_dict(file_name="issue10.xls")
     assert isinstance(newdict, OrderedDict) == True
     assert thedict == newdict
开发者ID:CHEN-JIANGHANG,项目名称:pyexcel,代码行数:9,代码来源:test_bug_fixes.py


示例12: test_save_as_to_database

 def test_save_as_to_database(self):
     adict = {
         "X": [1, 4],
         "Y": [2, 5],
         "Z": [3, 6]
     }
     pe.save_as(adict=adict, dest_session=self.session, dest_table=Signature)
     result = pe.get_dict(session=self.session, table=Signature)
     assert adict == result
开发者ID:pombredanne,项目名称:pyexcel,代码行数:9,代码来源:test_signature_fuction.py


示例13: test_save_as_and_append_colnames

 def test_save_as_and_append_colnames(self):
     data = [[1, 2, 3], [4, 5, 6]]
     sheet = pe.Sheet(data)
     testfile = "testfile.xls"
     testfile2 = "testfile.xls"
     sheet.save_as(testfile)
     pe.save_as(file_name=testfile, out_file=testfile2, colnames=["X", "Y", "Z"])
     array = pe.get_array(file_name=testfile2)
     assert array == [["X", "Y", "Z"], [1, 2, 3], [4, 5, 6]]
开发者ID:bdeeney,项目名称:pyexcel,代码行数:9,代码来源:test_signature_fuction.py


示例14: CVSOutput

 def CVSOutput(self,sortedTempSimilarityTuple):
     data = []
     for item in sortedTempSimilarityTuple:
         dataTuple = []
         relations = item[0].split("-")
         dataTuple.append(relations[0])
         dataTuple.append(relations[1])
         dataTuple.append(item[1])
         data.append(dataTuple)
     pyexcel.save_as(array = data, dest_file_name = 'testCSV.csv')
开发者ID:VaibhavDesai,项目名称:ContextGrahps,代码行数:10,代码来源:CPM-2.py


示例15: test_new_normal_usage

 def test_new_normal_usage(self):
     content = [
         [1, 2, 3],
         [4, 588, 6],
         [7, 8, 999]
     ]
     pe.save_as(array=content, dest_file_name=self.testfile)
     with open(self.testfile, "r") as f:
         written_content = json.load(f)
         assert written_content == content
开发者ID:i3visio,项目名称:pyexcel-text,代码行数:10,代码来源:test_io.py


示例16: test_mapping_array

 def test_mapping_array(self):
     data2 = [
         ["A", 1, 4],
         ["B", 2, 5],
         ["C", 3, 6]
     ]
     mapdict = ["X", "Y", "Z"]
     model=FakeDjangoModel()
     pe.save_as(array=data2, dest_model=model, dest_mapdict=mapdict, transpose_before=True)
     assert model.objects.objs == self.result
开发者ID:johnteifel,项目名称:pyexcel,代码行数:10,代码来源:test_django_related_functions.py


示例17: test_csvbook_irregular_columns

    def test_csvbook_irregular_columns(self):
        content = [
            [1, 2, 3],
            [4, 588, 6],
            [7, 8]
        ]
        self.testfile2 = "testfile.csv"
        pe.save_as(array=content, dest_file_name=self.testfile2)
        pe.save_as(file_name=self.testfile2, dest_file_name=self.testfile)

        self._check_test_file('csvbook_irregular_columns')
开发者ID:jayvdb,项目名称:pyexcel-text,代码行数:11,代码来源:test_io.py


示例18: test_row_series

    def test_row_series(self):
        content = [
            ["Row 1", 1, 2, 3],
            ["Row 2", 4, 5, 6],
            ["Row 3", 7, 8, 9]
        ]

        pe.save_as(array=content, name_rows_by_column=0,
                   dest_file_name=self.testfile)

        self._check_test_file('row_series')
开发者ID:jayvdb,项目名称:pyexcel-text,代码行数:11,代码来源:test_io.py


示例19: setUp

 def setUp(self):
     self.testfile = "test.xlsm"
     self.content = [
         ["X", "Y", "Z"],
         [1, 2, 3],
         [1, 2, 3],
         [1, 2, 3],
         [1, 2, 3],
         [1, 2, 3]
     ]
     pe.save_as(dest_file_name=self.testfile, array=self.content)
开发者ID:dardevelin,项目名称:pyexcel,代码行数:11,代码来源:test_iterator.py


示例20: test_column_series_irregular_columns

    def test_column_series_irregular_columns(self):
        content = [
            ["Column 1", "Column 2", "Column 3"],
            [1, 2, 3],
            [4, 5, 6],
            [7, 8]
        ]
        pe.save_as(array=content, name_columns_by_row=0,
                   dest_file_name=self.testfile)

        self._check_test_file('column_series_irregular_columns')
开发者ID:jayvdb,项目名称:pyexcel-text,代码行数:11,代码来源:test_io.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python pyexcel.save_book_as函数代码示例发布时间:2022-05-25
下一篇:
Python pyexcel.load_book函数代码示例发布时间:2022-05-25
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap