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


Python Babe.to_string方法代码示例

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


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

示例1: test_buzzdata

# 需要导入模块: from pybabe import Babe [as 别名]
# 或者: from pybabe.Babe import to_string [as 别名]
 def test_buzzdata(self):
     a = Babe().pull(
         protocol="buzzdata",
         dataroom="best-city-contest-worldwide-cost-of-living-index",
         uuid="aINAPyLGur4y37yAyCM7w3",
         username="eiu",
         format="xls",
     )
     a = a.head(2)
     a.to_string()
开发者ID:fdouetteau,项目名称:PyBabe,代码行数:12,代码来源:test_buzzdata.py

示例2: test_twitter

# 需要导入模块: from pybabe import Babe [as 别名]
# 或者: from pybabe.Babe import to_string [as 别名]
 def test_twitter(self):
     a = Babe().pull_twitter()
     a = a.filterColumns(keep_fields=["author_name",
                                      "author_id",
                                      "author_screen_name",
                                      "created_at",
                                      "hashtags",
                                      "text",
                                      "in_reply_to_status_id_str"])
     a = a.typedetect()
     a.to_string()
开发者ID:IsCoolEntertainment,项目名称:PyBabe,代码行数:13,代码来源:test_twitter.py

示例3: test_bulk

# 需要导入模块: from pybabe import Babe [as 别名]
# 或者: from pybabe.Babe import to_string [as 别名]
 def test_bulk(self):
     a = Babe().pull(stream=StringIO(self.s), format="csv")
     a = a.typedetect()
     a = a.bulkMapTo(lambda list: [[sum([r.a for r in list])]] * len(list),
                     bulk_size=2,
                     insert_fields=["b"])
     self.assertEquals(a.to_string(), self.s2)
开发者ID:IsCoolEntertainment,项目名称:PyBabe,代码行数:9,代码来源:test_transform.py

示例4: test_user_agent

# 需要导入模块: from pybabe import Babe [as 别名]
# 或者: from pybabe.Babe import to_string [as 别名]
 def test_user_agent(self):
     a = Babe().pull(string=self.s, format="csv")
     a = a.user_agent(field="useragent",
                      output_os="os",
                      output_browser="browser",
                      output_browser_version="browser_version")
     self.assertEquals(a.to_string(), self.s2)
开发者ID:IsCoolEntertainment,项目名称:PyBabe,代码行数:9,代码来源:test_user_agent.py

示例5: test_join_none

# 需要导入模块: from pybabe import Babe [as 别名]
# 或者: from pybabe.Babe import to_string [as 别名]
 def test_join_none(self):
     a = Babe().pull(string=self.s1, format='csv')
     a = a.join(join_stream=Babe().pull(string=self.s2_bis, format='csv'),
                key='country',
                join_key='country_code',
                on_error=Babe.ON_ERROR_NONE)
     self.assertEquals(a.to_string(), self.sjoined_bis)
开发者ID:IsCoolEntertainment,项目名称:PyBabe,代码行数:9,代码来源:test_join.py

示例6: test_http

# 需要导入模块: from pybabe import Babe [as 别名]
# 或者: from pybabe.Babe import to_string [as 别名]
 def test_http(self):
     a = Babe().pull(protocol='http',
                     host='localhost',
                     name='Test',
                     filename='remote/files/test.csv',
                     port=self.port)
     self.assertEquals(a.to_string(), 'foo,bar,f,d\n1,2,3.2,2010/10/02\n3,4,1.2,2011/02/02\n')
开发者ID:IsCoolEntertainment,项目名称:PyBabe,代码行数:9,代码来源:test_http.py

示例7: test_html

# 需要导入模块: from pybabe import Babe [as 别名]
# 或者: from pybabe.Babe import to_string [as 别名]
    def test_html(self):
        a = Babe().pull(string=self.s, format="csv")
        self.assertEqual(a.to_string(format="html"), """<h2></h2><table>
<tr><th>a</th><th>b</th></tr>
<tr><td>1</td><td>2</td></tr>
</table>
""")
开发者ID:IsCoolEntertainment,项目名称:PyBabe,代码行数:9,代码来源:test_html.py

示例8: test_insert

# 需要导入模块: from pybabe import Babe [as 别名]
# 或者: from pybabe.Babe import to_string [as 别名]
    def test_insert(self):
        a = Babe().pull(filename='tests/test.csv', name='Test').typedetect()
        a = a.mapTo(lambda row : row.foo+1, insert_fields=['fooplus'])
        s = """foo,bar,f,d,fooplus
1,2,3.2,2010/10/02,2
3,4,1.2,2011/02/02,4
"""
        self.assertEquals(a.to_string(), s)
开发者ID:fdouetteau,项目名称:PyBabe,代码行数:10,代码来源:test_transform.py

示例9: test_tuple

# 需要导入模块: from pybabe import Babe [as 别名]
# 或者: from pybabe.Babe import to_string [as 别名]
    def test_tuple(self):
        a = Babe().pull(filename='tests/test.csv', name='Test').typedetect()
        a = a.mapTo(lambda obj: obj._replace(foo=obj.foo + 1))
        s = """foo,bar,f,d
2,2,3.2,2010/10/02
4,4,1.2,2011/02/02
"""
        self.assertEquals(a.to_string(),  s)
开发者ID:fdouetteau,项目名称:PyBabe,代码行数:10,代码来源:test_transform.py

示例10: test_parse

# 需要导入模块: from pybabe import Babe [as 别名]
# 或者: from pybabe.Babe import to_string [as 别名]
 def test_parse(self):
     a = Babe().pull(stream=StringIO(self.s), format='csv')
     a = a.parse_time(field="time",
                      output_time="time",
                      output_date="date",
                      output_hour="hour",
                      input_timezone="CET",
                      output_timezone="GMT")
     self.assertEquals(a.to_string(), self.s2)
开发者ID:IsCoolEntertainment,项目名称:PyBabe,代码行数:11,代码来源:test_transform.py

示例11: test_pushsqlite

# 需要导入模块: from pybabe import Babe [as 别名]
# 或者: from pybabe.Babe import to_string [as 别名]
 def test_pushsqlite(self):
     a = Babe().pull(string=self.s, format='csv')
     a = a.typedetect()
     a.push_sql(table='test_table',
                database_kind='sqlite',
                database='tests/files/test.sqlite',
                drop_table=True,
                create_table=True)
     b = Babe().pull_sql(database_kind='sqlite',
                         database='tests/files/test.sqlite',
                         table='test_table')
     self.assertEquals(b.to_string(), self.s)
开发者ID:IsCoolEntertainment,项目名称:PyBabe,代码行数:14,代码来源:test_sql.py

示例12: test_pull_bigquery

# 需要导入模块: from pybabe import Babe [as 别名]
# 或者: from pybabe.Babe import to_string [as 别名]
    def test_pull_bigquery(self):
        dataset_id = 'ladata'
        day = '20151010'
        table_name = 'crazy_{}'.format(day)
        query = """
SELECT
    uid,
    count(1)
FROM
    [{}.{}]
WHERE
    name='pgr'
GROUP BY 1
ORDER BY 2 DESC;""".format(dataset_id, table_name)

        a = Babe().pull_bigquery(project_id='bigquery-testing-1098',
                                 query=query,
                                 timeout=1000,
                                 num_retries=2)

        print a.to_string()
开发者ID:IsCoolEntertainment,项目名称:PyBabe,代码行数:23,代码来源:test_kontagent_to_bigquery.py

示例13: test_pushsqlite_partition

# 需要导入模块: from pybabe import Babe [as 别名]
# 或者: from pybabe.Babe import to_string [as 别名]
    def test_pushsqlite_partition(self):
        a = Babe().pull(string=self.s, format='csv')
        a = a.typedetect()
        a.push_sql(table='test_table', database_kind='sqlite', database='test.sqlite', drop_table = True, create_table=True)

        a = Babe().pull(string=self.s2, format='csv')
        a = a.typedetect()
        a = a.partition(field='id')
        a.push_sql(table='test_table', database_kind='sqlite', database='test.sqlite', delete_partition=True)

        b = Babe().pull_sql(database_kind='sqlite', database='test.sqlite', table='test_table')
        b = b.sort(field="id")
        self.assertEquals(b.to_string(), self.sr)
开发者ID:fdouetteau,项目名称:PyBabe,代码行数:15,代码来源:test_sql.py

示例14: test_vectorwise

# 需要导入模块: from pybabe import Babe [as 别名]
# 或者: from pybabe.Babe import to_string [as 别名]
 def test_vectorwise(self):
     a = Babe().pull(string=self.s,
                     format='csv')
     a = a.typedetect()
     a.push_sql(table='test_table',
                database_kind='vectorwise',
                database='pybabe_test',
                drop_table=True,
                create_table=True)
     b = Babe().pull_sql(database_kind='vectorwise',
                         database='pybabe_test',
                         table='test_table')
     self.assertEquals(b.to_string(), self.s)
开发者ID:IsCoolEntertainment,项目名称:PyBabe,代码行数:15,代码来源:test_sql.py

示例15: test_s3

# 需要导入模块: from pybabe import Babe [as 别名]
# 或者: from pybabe.Babe import to_string [as 别名]
 def test_s3(self):
     s = "a,b\n1,2\n3,4\n"
     a = Babe().pull(string=s,
                     format='csv',
                     name='Test')
     a.push(filename='test3.csv',
            bucket='florian-test',
            protocol="s3")
     b = Babe().pull(filename='test3.csv',
                     name='Test',
                     bucket='florian-test',
                     protocol="s3")
     self.assertEquals(b.to_string(), s)
开发者ID:IsCoolEntertainment,项目名称:PyBabe,代码行数:15,代码来源:test_s3.py


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