Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
2e6c9c64
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
2e6c9c64
编写于
7月 30, 2022
作者:
sangshuduo
提交者:
GitHub
7月 30, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
docs: python connector pandas supplyment (#15604)
上级
cdbb7c9a
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
73 addition
and
6 deletion
+73
-6
docs/en/14-reference/03-connector/python.mdx
docs/en/14-reference/03-connector/python.mdx
+15
-0
docs/examples/python/conn_native_pandas.py
docs/examples/python/conn_native_pandas.py
+3
-3
docs/examples/python/conn_native_sqlalchemy.py
docs/examples/python/conn_native_sqlalchemy.py
+19
-0
docs/examples/python/conn_rest_pandas.py
docs/examples/python/conn_rest_pandas.py
+3
-3
docs/examples/python/conn_rest_sqlalchemy.py
docs/examples/python/conn_rest_sqlalchemy.py
+19
-0
docs/zh/14-reference/03-connector/python.mdx
docs/zh/14-reference/03-connector/python.mdx
+14
-0
未找到文件。
docs/en/14-reference/03-connector/python.mdx
浏览文件 @
2e6c9c64
...
...
@@ -293,6 +293,21 @@ For a more detailed description of the `sql()` method, please refer to [RestClie
{{#include docs/examples/python/conn_rest_pandas.py}}
```
</TabItem>
<Tabs default="native+sqlalchemy">
<TabItem value="native" label="原生连接 + SQLAlchemy">
```python
{{#include docs/examples/python/conn_native_sqlalchemy.py}}
```
</TabItem>
<TabItem value="rest+sqlalchemy" label="REST 连接 + SQLAlchemy">
```python
{{#include docs/examples/python/conn_rest_sqlachemy.py}}
```
</TabItem>
</Tabs>
...
...
docs/examples/python/conn_native_pandas.py
浏览文件 @
2e6c9c64
import
taos
import
pandas
from
sqlalchemy
import
create_engine
engine
=
create_engine
(
"taos://root:taosdata@localhost:6030/power"
)
df
=
pandas
.
read_sql
(
"SELECT * FROM meters"
,
engine
)
conn
=
taos
.
connect
(
)
df
:
pandas
.
DataFrame
=
pandas
.
read_sql
(
"SELECT * FROM meters"
,
conn
)
# print index
print
(
df
.
index
)
...
...
docs/examples/python/conn_native_sqlalchemy.py
0 → 100644
浏览文件 @
2e6c9c64
import
pandas
from
sqlalchemy
import
create_engine
engine
=
create_engine
(
"taos://root:taosdata@localhost:6030/power"
)
df
:
pandas
.
DataFrame
=
pandas
.
read_sql
(
"SELECT * FROM power.meters"
,
engine
)
# print index
print
(
df
.
index
)
# print data type of element in ts column
print
(
type
(
df
.
ts
[
0
]))
print
(
df
.
head
(
3
))
# output:
# RangeIndex(start=0, stop=8, step=1)
# <class 'pandas._libs.tslibs.timestamps.Timestamp'>
# ts current ... location groupid
# 0 2018-10-03 14:38:05.500 11.8 ... california.losangeles 2
# 1 2018-10-03 14:38:16.600 13.4 ... california.losangeles 2
# 2 2018-10-03 14:38:05.000 10.8 ... california.losangeles 3
docs/examples/python/conn_rest_pandas.py
浏览文件 @
2e6c9c64
import
taosrest
import
pandas
from
sqlalchemy
import
create_engine
engine
=
create_engine
(
"taosrest://root:taosdata@localhost:6041"
)
df
:
pandas
.
DataFrame
=
pandas
.
read_sql
(
"SELECT * FROM power.meters"
,
engine
)
conn
=
taosrest
.
connect
(
)
df
:
pandas
.
DataFrame
=
pandas
.
read_sql
(
"SELECT * FROM power.meters"
,
conn
)
# print index
print
(
df
.
index
)
...
...
docs/examples/python/conn_rest_sqlalchemy.py
0 → 100644
浏览文件 @
2e6c9c64
import
pandas
from
sqlalchemy
import
create_engine
engine
=
create_engine
(
"taosrest://root:taosdata@localhost:6041"
)
df
:
pandas
.
DataFrame
=
pandas
.
read_sql
(
"SELECT * FROM power.meters"
,
engine
)
# print index
print
(
df
.
index
)
# print data type of element in ts column
print
(
type
(
df
.
ts
[
0
]))
print
(
df
.
head
(
3
))
# output:
# RangeIndex(start=0, stop=8, step=1)
# <class 'pandas._libs.tslibs.timestamps.Timestamp'>
# ts current ... location groupid
# 0 2018-10-03 06:38:05.500000+00:00 11.8 ... california.losangeles 2
# 1 2018-10-03 06:38:16.600000+00:00 13.4 ... california.losangeles 2
# 2 2018-10-03 06:38:05+00:00 10.8 ... california.losangeles 3
docs/zh/14-reference/03-connector/python.mdx
浏览文件 @
2e6c9c64
...
...
@@ -295,6 +295,20 @@ TaosCursor 类使用原生连接进行写入、查询操作。在客户端多线
{{#include docs/examples/python/conn_rest_pandas.py}}
```
</TabItem>
<TabItem value="native+sqlalchemy" label="原生连接 + SQLAlchemy">
```python
{{#include docs/examples/python/conn_native_sqlalchemy.py}}
```
</TabItem>
<TabItem value="rest+sqlalchemy" label="REST 连接 + SQLAlchemy">
```python
{{#include docs/examples/python/conn_rest_sqlachemy.py}}
```
</TabItem>
</Tabs>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录