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


Python DataFrame._build_sqlite3_tbl方法代码示例

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


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

示例1: test4

# 需要导入模块: from pyvttbl import DataFrame [as 别名]
# 或者: from pyvttbl.DataFrame import _build_sqlite3_tbl [as 别名]
    def test4(self):
        df = DataFrame()
        df[1] = range(100)
        df[2] = ["bob" for i in range(100)]
        df[3] = [i * 1.234232 for i in range(100)]
        df[4] = ["bob" for i in range(50)] + range(50)

        with self.assertRaises(TypeError) as cm:
            df._build_sqlite3_tbl(df.keys()[:2], 42)

        self.assertEqual(str(cm.exception), "'int' object is not iterable")
开发者ID:ohfang,项目名称:pyvttbl,代码行数:13,代码来源:test_df_build_sqlite3_tbl.py

示例2: test31

# 需要导入模块: from pyvttbl import DataFrame [as 别名]
# 或者: from pyvttbl.DataFrame import _build_sqlite3_tbl [as 别名]
    def test31(self):
        df = DataFrame()
        df[1] = range(100)
        df[2] = ["bob" for i in range(100)]
        df[3] = [i * 1.234232 for i in range(100)]
        df[4] = ["bob" for i in range(50)] + range(50)

        shuffle(df[1])
        shuffle(df[2])
        shuffle(df[3])

        with self.assertRaises(KeyError) as cm:
            df._build_sqlite3_tbl(df.keys()[:2], ['4 != "bob"'])

        self.assertEqual(str(cm.exception), "'4'")
开发者ID:ohfang,项目名称:pyvttbl,代码行数:17,代码来源:test_df_build_sqlite3_tbl.py

示例3: test3

# 需要导入模块: from pyvttbl import DataFrame [as 别名]
# 或者: from pyvttbl.DataFrame import _build_sqlite3_tbl [as 别名]
    def test3(self):
        """test with string keys and tuple where condition"""
        df = DataFrame()
        df[1] = range(100)
        df[2] = ["bob" for i in range(100)]
        df[3] = [i * 1.234232 for i in range(100)]
        df[4] = ["bob" for i in range(50)] + range(50)

        shuffle(df[1])
        shuffle(df[2])
        shuffle(df[3])

        df._build_sqlite3_tbl(df.keys()[:2], [(4, "!=", "bob")])

        df._execute("select * from TBL")
        for i, (a, b) in enumerate(df.cur):
            self.assertEqual(a, df[1][i + 50])
            self.assertEqual(b, df[2][i + 50])
开发者ID:ohfang,项目名称:pyvttbl,代码行数:20,代码来源:test_df_build_sqlite3_tbl.py

示例4: test22

# 需要导入模块: from pyvttbl import DataFrame [as 别名]
# 或者: from pyvttbl.DataFrame import _build_sqlite3_tbl [as 别名]
    def test22(self):
        """test with string keys and where condition"""
        df = DataFrame()
        df["1"] = range(100)
        df["2"] = ["bob" for i in range(100)]
        df["3"] = [i * 1.234232 for i in range(100)]
        df["4"] = ["bob" for i in range(50)] + range(50)

        shuffle(df["1"])
        shuffle(df["2"])
        shuffle(df["3"])

        df._build_sqlite3_tbl(df.keys()[:2], ['4 not in ("bob")'])

        df._execute("select * from TBL")
        for i, (a, b) in enumerate(df.cur):
            self.assertEqual(a, df["1"][i + 50])
            self.assertEqual(b, df["2"][i + 50])
开发者ID:ohfang,项目名称:pyvttbl,代码行数:20,代码来源:test_df_build_sqlite3_tbl.py

示例5: test1

# 需要导入模块: from pyvttbl import DataFrame [as 别名]
# 或者: from pyvttbl.DataFrame import _build_sqlite3_tbl [as 别名]
    def test1(self):
        """test with integer keys subset of table"""
        df = DataFrame()
        df[1] = range(100)
        df[2] = ["bob" for i in range(100)]
        df[3] = [i * 1.234232 for i in range(100)]
        df[4] = ["bob" for i in range(50)] + range(50)

        shuffle(df[1])
        shuffle(df[2])
        shuffle(df[3])
        shuffle(df[4])

        df._build_sqlite3_tbl(df.keys()[:2])

        df._execute("select * from TBL")
        for i, (a, b) in enumerate(df.cur):
            self.assertEqual(a, df[1][i])
            self.assertEqual(b, df[2][i])
开发者ID:ohfang,项目名称:pyvttbl,代码行数:21,代码来源:test_df_build_sqlite3_tbl.py

示例6: test02

# 需要导入模块: from pyvttbl import DataFrame [as 别名]
# 或者: from pyvttbl.DataFrame import _build_sqlite3_tbl [as 别名]
    def test02(self):
        """test with tuple keys"""
        df = DataFrame()
        ##        df.PRINTQUERIES = True
        df[(1,)] = range(100)
        df[(2,)] = ["bob" for i in range(100)]
        df[(3,)] = [i * 1.234232 for i in range(100)]
        df[(4,)] = ["bob" for i in range(50)] + range(50)

        shuffle(df[(1,)])
        shuffle(df[(2,)])
        shuffle(df[(3,)])
        shuffle(df[(4,)])

        df._build_sqlite3_tbl(df.keys())

        df._execute("select * from TBL")
        for i, (a, b, c, d) in enumerate(df.cur):
            self.assertEqual(a, df[(1,)][i])
            self.assertEqual(b, df[(2,)][i])
            self.assertEqual(c, df[(3,)][i])
            self.assertEqual(d, str(df[(4,)][i]))
开发者ID:ohfang,项目名称:pyvttbl,代码行数:24,代码来源:test_df_build_sqlite3_tbl.py

示例7: test00

# 需要导入模块: from pyvttbl import DataFrame [as 别名]
# 或者: from pyvttbl.DataFrame import _build_sqlite3_tbl [as 别名]
    def test00(self):
        """test with string keys"""
        df = DataFrame()
        ##        df.PRINTQUERIES=True
        df["1"] = range(100)
        df["2"] = ["bob" for i in range(100)]
        df["3"] = [i * 1.234232 for i in range(100)]
        df["4"] = ["bob" for i in range(50)] + range(50)

        df["5"] = np.sqrt(df["3"] * 100.0)
        ##        print(df)

        shuffle(df["1"])
        shuffle(df["2"])
        shuffle(df["3"])

        df._build_sqlite3_tbl(df.keys())

        df._execute("select * from TBL")
        for i, (a, b, c, d, e) in enumerate(df.cur):
            self.assertEqual(a, df["1"][i])
            self.assertEqual(b, df["2"][i])
            self.assertEqual(c, df["3"][i])
            self.assertEqual(d, str(df["4"][i]))
开发者ID:ohfang,项目名称:pyvttbl,代码行数:26,代码来源:test_df_build_sqlite3_tbl.py


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