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


Python TableFu.from_file方法代码示例

本文整理汇总了Python中table_fu.TableFu.from_file方法的典型用法代码示例。如果您正苦于以下问题:Python TableFu.from_file方法的具体用法?Python TableFu.from_file怎么用?Python TableFu.from_file使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在table_fu.TableFu的用法示例。


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

示例1: csvviresult

# 需要导入模块: from table_fu import TableFu [as 别名]
# 或者: from table_fu.TableFu import from_file [as 别名]
def csvviresult():
    global table
    # data = request.form['text']
    # table = TableFu.from_file('app/vi-csv.csv')
    table = TableFu.from_file('app/vi-csv.csv')
    # return render_template('vi-template.html', table=table)
    return render_template('vi-template.html', table=table)
开发者ID:cornelius-k,项目名称:localflaskhighlights,代码行数:9,代码来源:views.py

示例2: test_set_columns

# 需要导入模块: from table_fu import TableFu [as 别名]
# 或者: from table_fu.TableFu import from_file [as 别名]
    def test_set_columns(self):
        arra = TableFu.from_file(self.filename)
        arra.columns = ["State", "County", "Urban Area"]

        tabled = Table(
            title="That Stimulus", added_by=self.user, file=File(self.file), columns=["State", "County", "Urban Area"]
        )
        tabled.save()

        self.assertEqual(arra.columns, tabled.data.columns)
开发者ID:homicidewatch,项目名称:table-masher,代码行数:12,代码来源:models.py

示例3: virtualissueautomate

# 需要导入模块: from table_fu import TableFu [as 别名]
# 或者: from table_fu.TableFu import from_file [as 别名]
def virtualissueautomate():
    
    myDOIs = str(request.form["text"]).split('\r\n')
    
 
     # run python process
    createVI(myDOIs)

    global table
    # data = request.form['text']
    table = TableFu.from_file('vi-csv.csv')
    return render_template('vi-template.html', table=table, results=results)
开发者ID:cornelius-k,项目名称:localflaskhighlights,代码行数:14,代码来源:views.py

示例4: podcastupload

# 需要导入模块: from table_fu import TableFu [as 别名]
# 或者: from table_fu.TableFu import from_file [as 别名]
def podcastupload():
    if request.method == 'POST':
    # Get the name of uploaded file
        file = request.files['file']
        # Check if the file is an allowed extension
        if file and allowed_file(file.filename):
            # Make the filename safe - remove unsupported characters
            filename = secure_filename(file.filename)
            # # Move the file from the temp folder to the upload folder
            file.save(os.path.join(app.config["UPLOAD_FOLDER"], filename))
            # Use tablefu to template out the uploaded CSV file
            global table
            table = TableFu.from_file('app/static/uploads/' + filename)
            return render_template('podcastresults.html', table=table)
开发者ID:tsboom,项目名称:localflaskhighlights,代码行数:16,代码来源:views.py

示例5: facet

# 需要导入模块: from table_fu import TableFu [as 别名]
# 或者: from table_fu.TableFu import from_file [as 别名]
def facet(starter, *facets):
    table = TableFu.from_file(starter)
    out_dir = os.path.dirname(starter)
    files = []
    for f in facets:
        try:
            tables = table.facet_by(f)
        except KeyError:
            sys.stderr.write('Bad column name: %s\n' % f)
            sys.stderr.write('Available columns: %s\n\n' % ', '.join(table.columns))
            continue

        for t in tables:
            out = open(os.path.join(out_dir, '%s.csv' % t.faceted_on), 'wb')
            out.write(t.csv().getvalue())
            out.close()
            files.append(out.name)
    
    return files
开发者ID:homicidewatch,项目名称:table-masher,代码行数:21,代码来源:facet.py

示例6: data

# 需要导入模块: from table_fu import TableFu [as 别名]
# 或者: from table_fu.TableFu import from_file [as 别名]
 def data(self):
     """Return a TableFu instance with data for this model"""
     if hasattr(self, '_data') and self._data is not None:
         return self._data
     
     if self.file:
         # this gets wrapped in a with block for cleanliness
         d = TableFu.from_file(self.file.path)
     
     elif self.url:
         d = TableFu.from_url(self.url)
     
     else:
         return None
             
     if self.columns:
         d.columns = self.columns
     
     self._data = d
     return self._data
开发者ID:homicidewatch,项目名称:table-masher,代码行数:22,代码来源:models.py

示例7: podcastresult

# 需要导入模块: from table_fu import TableFu [as 别名]
# 或者: from table_fu.TableFu import from_file [as 别名]
def podcastresult():
    global table
    table = TableFu.from_file('app/chembio.csv')
    return render_template('podcastresultsnano.html', table=table)
开发者ID:cornelius-k,项目名称:localflaskhighlights,代码行数:6,代码来源:views.py

示例8: test_from_file

# 需要导入模块: from table_fu import TableFu [as 别名]
# 或者: from table_fu.TableFu import from_file [as 别名]
 def test_from_file(self):
     t1 = TableFu.from_file('tests/arra.csv')
     t2 = TableFu(open('tests/arra.csv'))
     self.assertEqual(t1.table, t2.table)
开发者ID:JNRowe-retired,项目名称:python-tablefu,代码行数:6,代码来源:test.py

示例9: test_from_file

# 需要导入模块: from table_fu import TableFu [as 别名]
# 或者: from table_fu.TableFu import from_file [as 别名]
    def test_from_file(self):
        arra = TableFu.from_file(self.filename)
        tabled = Table(title="That Stimulus", added_by=self.user, file=File(self.file))
        tabled.save()

        self.assertEqual(arra.table, tabled.data.table)
开发者ID:homicidewatch,项目名称:table-masher,代码行数:8,代码来源:models.py


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