Skip to content

Commit a3eae33

Browse files
authored
adjust quickstart python chapter (#699)
1 parent b752dfa commit a3eae33

4 files changed

Lines changed: 178 additions & 183 deletions

File tree

src/UserGuide/develop/QuickStart/QuickStart-PYTHON.md

Lines changed: 44 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -20,34 +20,11 @@
2020
-->
2121
# Quick Start - Python
2222

23-
## Dependencies
24-
25-
If want to compile on your local envirment, the dependencies are below:
26-
27-
- CMake >=3.11
28-
- Maven >=3.9.6
29-
- GCC >=4.8.5
30-
- Make >=4.3
31-
- cython >= 3.0.10
32-
- numpy >= 1.26.4
33-
- pandas >= 2.2.2
34-
- setuptools >= 70.0.0
35-
36-
or use pip install, the dependencies are:
37-
38-
numpy >= 1.26.4
39-
pandas >= 2.2.2
40-
41-
## Installation Method
23+
## Dependencies and Installation
4224

4325
### Install From Pypi
4426

45-
Use pip to install the latest version from pypi:
46-
47-
```shell
48-
pip install tsfile
49-
```
50-
Platform support:
27+
1. Platform support:
5128

5229
| Platform | python |
5330
| ------------- | -------------------------------- |
@@ -57,41 +34,61 @@ Platform support:
5734
| MacOS_X86_64 | py39, py310, py311, py312, py313 |
5835
| Win_amd64 | py39, py310, py311, py312, py313 |
5936

60-
To download wheel from pypi: https://pypi.org/project/tsfile/#files
37+
2. Dependencies:
6138

39+
* numpy >= 1.26.4
40+
* pandas >= 2.2.2
6241

63-
64-
### Compile on your local envirment
65-
Clone the source code from git:
42+
3. Use pip to install the latest version from pypi:
6643

6744
```shell
68-
git clone https://github.com/apache/tsfile.git
45+
pip install tsfile
6946
```
70-
Run Maven to compile in the TsFile root directory:
7147

72-
```shell
73-
mvn clean install -P with-python -DskipTests
48+
### Install From Wheel File
49+
50+
1. Download wheel from pypi: https://pypi.org/project/tsfile/#files
51+
2. Install the wheel file using the pip install command.
52+
```bash
53+
pip install tsfile.wheel
7454
```
7555

76-
If Maven is not installed, you can compile tsfile using the following command:
56+
### Install From Source Code Compilation
57+
1. Dependencies
7758

78-
Linux or Macos:
79-
```shell
80-
mvnw clean install -P with-python -DskipTests
81-
```
82-
Windows:
83-
```shell
84-
mvnw.cmd clean install -P with-python -DskipTests
85-
```
59+
- CMake >=3.11
60+
- Maven >=3.9.6
61+
- GCC >=4.8.5
62+
- Make >=4.3
63+
- cython >= 3.0.10
64+
- numpy >= 1.26.4
65+
- pandas >= 2.2.2
66+
- setuptools >= 70.0.0
8667

87-
### Directory Structure
68+
2. Installation steps
8869

89-
**wheel**: Located at `tsfile/python/dist`, you can use pip to install this wheel.
70+
* Clone the source code from git:
9071

91-
### Install into your local envirment
72+
```shell
73+
git clone https://github.com/apache/tsfile.git
74+
```
75+
* Run Maven to compile in the TsFile root directory:
9276

93-
run `pip install` to install tsfile package you already compiled(Assuming the compilation produces tsfile.wheel.).
77+
```shell
78+
mvn clean install -P with-python -DskipTests
79+
```
9480

81+
* If Maven is not installed, you can compile tsfile using the following command:
82+
83+
* Linux or Macos:
84+
```shell
85+
mvnw clean install -P with-python -DskipTests
86+
```
87+
* Windows:
88+
```shell
89+
mvnw.cmd clean install -P with-python -DskipTests
90+
```
91+
* After successful compilation, the wheel file will be located in the `tsfile/python/dist` directory and can be installed locally using the pip install command (assuming its name is `tsfile.wheel`).
9592
```bash
9693
pip install tsfile.wheel
9794
```
@@ -148,7 +145,7 @@ with TsFileReader(table_data_dir) as reader:
148145
print(result.read_data_frame())
149146
```
150147
151-
use `to_dataframe` to read tsfile as dataframe.
148+
Use `to_dataframe` to read tsfile as dataframe.
152149
153150
```Python
154151
import os

src/UserGuide/latest/QuickStart/QuickStart-PYTHON.md

Lines changed: 43 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -20,34 +20,11 @@
2020
-->
2121
# Quick Start - Python
2222

23-
## Dependencies
24-
25-
If want to compile on your local envirment, the dependencies are below:
26-
27-
- CMake >=3.11
28-
- Maven >=3.9.6
29-
- GCC >=4.8.5
30-
- Make >=4.3
31-
- cython >= 3.0.10
32-
- numpy >= 1.26.4
33-
- pandas >= 2.2.2
34-
- setuptools >= 70.0.0
35-
36-
or use pip install, the dependencies are:
37-
38-
numpy >= 1.26.4
39-
pandas >= 2.2.2
40-
41-
## Installation Method
23+
## Dependencies and Installation
4224

4325
### Install From Pypi
4426

45-
Use pip to install the latest version from pypi:
46-
47-
```shell
48-
pip install tsfile
49-
```
50-
Platform support:
27+
1. Platform support:
5128

5229
| Platform | python |
5330
| ------------- | -------------------------------- |
@@ -57,41 +34,61 @@ Platform support:
5734
| MacOS_X86_64 | py39, py310, py311, py312, py313 |
5835
| Win_amd64 | py39, py310, py311, py312, py313 |
5936

60-
To download wheel from pypi: https://pypi.org/project/tsfile/#files
37+
2. Dependencies:
6138

39+
* numpy >= 1.26.4
40+
* pandas >= 2.2.2
6241

63-
64-
### Compile on your local envirment
65-
Clone the source code from git:
42+
3. Use pip to install the latest version from pypi:
6643

6744
```shell
68-
git clone https://github.com/apache/tsfile.git
45+
pip install tsfile
6946
```
70-
Run Maven to compile in the TsFile root directory:
7147

72-
```shell
73-
mvn clean install -P with-python -DskipTests
48+
### Install From Wheel File
49+
50+
1. Download wheel from pypi: https://pypi.org/project/tsfile/#files
51+
2. Install the wheel file using the pip install command.
52+
```bash
53+
pip install tsfile.wheel
7454
```
7555

76-
If Maven is not installed, you can compile tsfile using the following command:
56+
### Install From Source Code Compilation
57+
1. Dependencies
7758

78-
Linux or Macos:
79-
```shell
80-
mvnw clean install -P with-python -DskipTests
81-
```
82-
Windows:
83-
```shell
84-
mvnw.cmd clean install -P with-python -DskipTests
85-
```
59+
- CMake >=3.11
60+
- Maven >=3.9.6
61+
- GCC >=4.8.5
62+
- Make >=4.3
63+
- cython >= 3.0.10
64+
- numpy >= 1.26.4
65+
- pandas >= 2.2.2
66+
- setuptools >= 70.0.0
8667

87-
### Directory Structure
68+
2. Installation steps
8869

89-
**wheel**: Located at `tsfile/python/dist`, you can use pip to install this wheel.
70+
* Clone the source code from git:
9071

91-
### Install into your local envirment
72+
```shell
73+
git clone https://github.com/apache/tsfile.git
74+
```
75+
* Run Maven to compile in the TsFile root directory:
9276

93-
run `pip install` to install tsfile package you already compiled(Assuming the compilation produces tsfile.wheel.).
77+
```shell
78+
mvn clean install -P with-python -DskipTests
79+
```
9480

81+
* If Maven is not installed, you can compile tsfile using the following command:
82+
83+
* Linux or Macos:
84+
```shell
85+
mvnw clean install -P with-python -DskipTests
86+
```
87+
* Windows:
88+
```shell
89+
mvnw.cmd clean install -P with-python -DskipTests
90+
```
91+
* After successful compilation, the wheel file will be located in the `tsfile/python/dist` directory and can be installed locally using the pip install command (assuming its name is `tsfile.wheel`).
9592
```bash
9693
pip install tsfile.wheel
9794
```

src/zh/UserGuide/develop/QuickStart/QuickStart-PYTHON.md

Lines changed: 47 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -20,35 +20,11 @@
2020
-->
2121
# 快速上手 - Python
2222

23-
## 依赖
23+
## 依赖安装
2424

25-
如果需要在在本地编译,依赖如下所示:
25+
### 使用 PIP 在线安装
2626

27-
- CMake >=3.11
28-
- Maven >=3.9.6
29-
- GCC >=4.8.5
30-
- Make >=4.3
31-
- cython >= 3.0.10
32-
- numpy >= 1.26.4
33-
- pandas >= 2.2.2
34-
- setuptools >= 70.0.0
35-
36-
如果使用 Pip 在线安装 TsFile,依赖包如下:
37-
38-
numpy >= 1.26.4
39-
pandas >= 2.2.2
40-
41-
## 安装
42-
43-
### 使用 PIP 进行在线安装
44-
45-
使用pip 指令来在线安装 TsFile 包
46-
47-
```bash
48-
pip install tsfile
49-
```
50-
51-
支持的架构平台如下:
27+
1. 架构平台支持情况
5228

5329
| Platform | python |
5430
| ------------- | -------------------------------- |
@@ -58,46 +34,69 @@ pip install tsfile
5834
| MacOS_X86_64 | py39, py310, py311, py312, py313 |
5935
| Win_amd64 | py39, py310, py311, py312, py313 |
6036

61-
或者直接下载 wheel 文件安装:https://pypi.org/project/tsfile/#files
37+
2. 安装依赖版本要求
6238

39+
* numpy >= 1.26.4
40+
* pandas >= 2.2.2
6341

64-
### 在本地进行编译
42+
3. 安装步骤
6543

66-
从git克隆源代码:
44+
通过 pip 指令在线安装
6745

68-
```shell
69-
git clone https://github.com/apache/tsfile.git
46+
```bash
47+
pip install tsfile
7048
```
71-
在 TsFile 根目录下执行 maven 编译:
7249

73-
```shell
74-
mvn clean install -P with-python -DskipTests
50+
### 下载 wheel 文件手动安装
51+
52+
1. 下载 wheel 文件:https://pypi.org/project/tsfile/#files
53+
2. 通过 pip install 命令安装 wheel 文件
54+
```bash
55+
pip install tsfile.wheel
7556
```
7657

77-
如果没有安装 maven, 你可以执行下面的指令完成编译:
58+
### 源码编译安装
59+
1. 安装依赖版本要求
60+
61+
- CMake >=3.11
62+
- Maven >=3.9.6
63+
- GCC >=4.8.5
64+
- Make >=4.3
65+
- cython >= 3.0.10
66+
- numpy >= 1.26.4
67+
- pandas >= 2.2.2
68+
- setuptools >= 70.0.0
69+
70+
2. 安装步骤
71+
* 从git克隆源代码:
7872

79-
在 Linux 或 Macos上:
8073
```shell
81-
mvnw clean install -P with-python -DskipTests
74+
git clone https://github.com/apache/tsfile.git
8275
```
83-
在 Windows 上:
76+
* 在 TsFile 根目录下执行 maven 编译:
8477

8578
```shell
86-
mvnw.cmd clean install -P with-python -DskipTests
79+
mvn clean install -P with-python -DskipTests
8780
```
88-
#### 目录结构
8981

90-
**wheel**: wheel文件位于 `tsfile/python/dist`, 你可以使用 pip install 命令来进行本地安装。
82+
* 如果没有安装 maven, 你可以执行下面的指令完成编译:
9183

92-
### 安装到本地
84+
* 在 Linux 或 Macos上:
85+
```shell
86+
mvnw clean install -P with-python -DskipTests
87+
```
88+
* 在 Windows 上:
9389

94-
你可以执行 `pip install`命令来安装编译得到的 tsfile包(假设他的名字是 tsfile.wheel)
90+
```shell
91+
mvnw.cmd clean install -P with-python -DskipTests
92+
```
93+
94+
* 编译成功后,wheel 文件将位于 `tsfile/python/dist` 目录下, 可通过 pip install 命令进行本地安装(假设他的名字是 tsfile.wheel)
9595

9696
```bash
9797
pip install tsfile.wheel
9898
```
9999

100-
101100
## 写入示例
102101

103102
```Python
@@ -149,6 +148,7 @@ with TsFileReader(table_data_dir) as reader:
149148
print(result.read_data_frame())
150149
```
151150
151+
152152
使用 `to_dataframe` 读取 TsFile 为 Dataframe.
153153
154154
```Python
@@ -158,8 +158,10 @@ table_data_dir = os.path.join(os.path.dirname(__file__), "table_data.tsfile")
158158
print(ts.to_dataframe(table_data_dir))
159159
```
160160
161+
161162
## 示例代码
162163
163164
使用这些接口的示例代码可以在以下链接中找到:https://github.com/apache/tsfile/blob/develop/python/examples/example.py
164165
165166
> 注意:以上读写示例均基于表模型接口,接口定义介绍可见[Python 接口定义](./InterfaceDefinition/InterfaceDefinition-Python.md)。若需了解树模型相关内容,请联系我们。
167+

0 commit comments

Comments
 (0)