From 367d1840422ad0869650806e78940ab87047f7a1 Mon Sep 17 00:00:00 2001 From: Leto_b Date: Thu, 8 Jan 2026 11:15:46 +0800 Subject: [PATCH] adjust quickstart python chapter --- .../develop/QuickStart/QuickStart-PYTHON.md | 91 +++++++++--------- .../latest/QuickStart/QuickStart-PYTHON.md | 89 +++++++++--------- .../develop/QuickStart/QuickStart-PYTHON.md | 92 ++++++++++--------- .../latest/QuickStart/QuickStart-PYTHON.md | 89 +++++++++--------- 4 files changed, 178 insertions(+), 183 deletions(-) diff --git a/src/UserGuide/develop/QuickStart/QuickStart-PYTHON.md b/src/UserGuide/develop/QuickStart/QuickStart-PYTHON.md index e748ed509..c29dfba4c 100644 --- a/src/UserGuide/develop/QuickStart/QuickStart-PYTHON.md +++ b/src/UserGuide/develop/QuickStart/QuickStart-PYTHON.md @@ -20,34 +20,11 @@ --> # Quick Start - Python -## Dependencies - -If want to compile on your local envirment, the dependencies are below: - -- CMake >=3.11 -- Maven >=3.9.6 -- GCC >=4.8.5 -- Make >=4.3 -- cython >= 3.0.10 -- numpy >= 1.26.4 -- pandas >= 2.2.2 -- setuptools >= 70.0.0 - -or use pip install, the dependencies are: - -numpy >= 1.26.4 -pandas >= 2.2.2 - -## Installation Method +## Dependencies and Installation ### Install From Pypi -Use pip to install the latest version from pypi: - -```shell -pip install tsfile -``` -Platform support: +1. Platform support: | Platform | python | | ------------- | -------------------------------- | @@ -57,41 +34,61 @@ Platform support: | MacOS_X86_64 | py39, py310, py311, py312, py313 | | Win_amd64 | py39, py310, py311, py312, py313 | -To download wheel from pypi: https://pypi.org/project/tsfile/#files +2. Dependencies: + * numpy >= 1.26.4 + * pandas >= 2.2.2 - -### Compile on your local envirment -Clone the source code from git: +3. Use pip to install the latest version from pypi: ```shell -git clone https://github.com/apache/tsfile.git +pip install tsfile ``` -Run Maven to compile in the TsFile root directory: -```shell -mvn clean install -P with-python -DskipTests +### Install From Wheel File + +1. Download wheel from pypi: https://pypi.org/project/tsfile/#files +2. Install the wheel file using the pip install command. +```bash +pip install tsfile.wheel ``` -If Maven is not installed, you can compile tsfile using the following command: +### Install From Source Code Compilation +1. Dependencies -Linux or Macos: -```shell -mvnw clean install -P with-python -DskipTests -``` -Windows: -```shell -mvnw.cmd clean install -P with-python -DskipTests -``` + - CMake >=3.11 + - Maven >=3.9.6 + - GCC >=4.8.5 + - Make >=4.3 + - cython >= 3.0.10 + - numpy >= 1.26.4 + - pandas >= 2.2.2 + - setuptools >= 70.0.0 -### Directory Structure +2. Installation steps -• **wheel**: Located at `tsfile/python/dist`, you can use pip to install this wheel. +* Clone the source code from git: -### Install into your local envirment +```shell +git clone https://github.com/apache/tsfile.git +``` +* Run Maven to compile in the TsFile root directory: -run `pip install` to install tsfile package you already compiled(Assuming the compilation produces tsfile.wheel.). +```shell +mvn clean install -P with-python -DskipTests +``` +* If Maven is not installed, you can compile tsfile using the following command: + + * Linux or Macos: + ```shell + mvnw clean install -P with-python -DskipTests + ``` + * Windows: + ```shell + mvnw.cmd clean install -P with-python -DskipTests + ``` +* 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`). ```bash pip install tsfile.wheel ``` @@ -148,7 +145,7 @@ with TsFileReader(table_data_dir) as reader: print(result.read_data_frame()) ``` -use `to_dataframe` to read tsfile as dataframe. +Use `to_dataframe` to read tsfile as dataframe. ```Python import os diff --git a/src/UserGuide/latest/QuickStart/QuickStart-PYTHON.md b/src/UserGuide/latest/QuickStart/QuickStart-PYTHON.md index 9aa9e5710..c29dfba4c 100644 --- a/src/UserGuide/latest/QuickStart/QuickStart-PYTHON.md +++ b/src/UserGuide/latest/QuickStart/QuickStart-PYTHON.md @@ -20,34 +20,11 @@ --> # Quick Start - Python -## Dependencies - -If want to compile on your local envirment, the dependencies are below: - -- CMake >=3.11 -- Maven >=3.9.6 -- GCC >=4.8.5 -- Make >=4.3 -- cython >= 3.0.10 -- numpy >= 1.26.4 -- pandas >= 2.2.2 -- setuptools >= 70.0.0 - -or use pip install, the dependencies are: - -numpy >= 1.26.4 -pandas >= 2.2.2 - -## Installation Method +## Dependencies and Installation ### Install From Pypi -Use pip to install the latest version from pypi: - -```shell -pip install tsfile -``` -Platform support: +1. Platform support: | Platform | python | | ------------- | -------------------------------- | @@ -57,41 +34,61 @@ Platform support: | MacOS_X86_64 | py39, py310, py311, py312, py313 | | Win_amd64 | py39, py310, py311, py312, py313 | -To download wheel from pypi: https://pypi.org/project/tsfile/#files +2. Dependencies: + * numpy >= 1.26.4 + * pandas >= 2.2.2 - -### Compile on your local envirment -Clone the source code from git: +3. Use pip to install the latest version from pypi: ```shell -git clone https://github.com/apache/tsfile.git +pip install tsfile ``` -Run Maven to compile in the TsFile root directory: -```shell -mvn clean install -P with-python -DskipTests +### Install From Wheel File + +1. Download wheel from pypi: https://pypi.org/project/tsfile/#files +2. Install the wheel file using the pip install command. +```bash +pip install tsfile.wheel ``` -If Maven is not installed, you can compile tsfile using the following command: +### Install From Source Code Compilation +1. Dependencies -Linux or Macos: -```shell -mvnw clean install -P with-python -DskipTests -``` -Windows: -```shell -mvnw.cmd clean install -P with-python -DskipTests -``` + - CMake >=3.11 + - Maven >=3.9.6 + - GCC >=4.8.5 + - Make >=4.3 + - cython >= 3.0.10 + - numpy >= 1.26.4 + - pandas >= 2.2.2 + - setuptools >= 70.0.0 -### Directory Structure +2. Installation steps -• **wheel**: Located at `tsfile/python/dist`, you can use pip to install this wheel. +* Clone the source code from git: -### Install into your local envirment +```shell +git clone https://github.com/apache/tsfile.git +``` +* Run Maven to compile in the TsFile root directory: -run `pip install` to install tsfile package you already compiled(Assuming the compilation produces tsfile.wheel.). +```shell +mvn clean install -P with-python -DskipTests +``` +* If Maven is not installed, you can compile tsfile using the following command: + + * Linux or Macos: + ```shell + mvnw clean install -P with-python -DskipTests + ``` + * Windows: + ```shell + mvnw.cmd clean install -P with-python -DskipTests + ``` +* 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`). ```bash pip install tsfile.wheel ``` diff --git a/src/zh/UserGuide/develop/QuickStart/QuickStart-PYTHON.md b/src/zh/UserGuide/develop/QuickStart/QuickStart-PYTHON.md index 543333e25..8b435f37c 100644 --- a/src/zh/UserGuide/develop/QuickStart/QuickStart-PYTHON.md +++ b/src/zh/UserGuide/develop/QuickStart/QuickStart-PYTHON.md @@ -20,35 +20,11 @@ --> # 快速上手 - Python -## 依赖 +## 依赖安装 -如果需要在在本地编译,依赖如下所示: +### 使用 PIP 在线安装 -- CMake >=3.11 -- Maven >=3.9.6 -- GCC >=4.8.5 -- Make >=4.3 -- cython >= 3.0.10 -- numpy >= 1.26.4 -- pandas >= 2.2.2 -- setuptools >= 70.0.0 - -如果使用 Pip 在线安装 TsFile,依赖包如下: - -numpy >= 1.26.4 -pandas >= 2.2.2 - -## 安装 - -### 使用 PIP 进行在线安装 - -使用pip 指令来在线安装 TsFile 包 - -```bash -pip install tsfile -``` - -支持的架构平台如下: +1. 架构平台支持情况 | Platform | python | | ------------- | -------------------------------- | @@ -58,46 +34,69 @@ pip install tsfile | MacOS_X86_64 | py39, py310, py311, py312, py313 | | Win_amd64 | py39, py310, py311, py312, py313 | -或者直接下载 wheel 文件安装:https://pypi.org/project/tsfile/#files +2. 安装依赖版本要求 + * numpy >= 1.26.4 + * pandas >= 2.2.2 -### 在本地进行编译 +3. 安装步骤 -从git克隆源代码: +通过 pip 指令在线安装 -```shell -git clone https://github.com/apache/tsfile.git +```bash +pip install tsfile ``` -在 TsFile 根目录下执行 maven 编译: -```shell -mvn clean install -P with-python -DskipTests +### 下载 wheel 文件手动安装 + +1. 下载 wheel 文件:https://pypi.org/project/tsfile/#files +2. 通过 pip install 命令安装 wheel 文件 +```bash +pip install tsfile.wheel ``` -如果没有安装 maven, 你可以执行下面的指令完成编译: +### 源码编译安装 +1. 安装依赖版本要求 + + - CMake >=3.11 + - Maven >=3.9.6 + - GCC >=4.8.5 + - Make >=4.3 + - cython >= 3.0.10 + - numpy >= 1.26.4 + - pandas >= 2.2.2 + - setuptools >= 70.0.0 + +2. 安装步骤 +* 从git克隆源代码: -在 Linux 或 Macos上: ```shell -mvnw clean install -P with-python -DskipTests +git clone https://github.com/apache/tsfile.git ``` -在 Windows 上: +* 在 TsFile 根目录下执行 maven 编译: ```shell -mvnw.cmd clean install -P with-python -DskipTests +mvn clean install -P with-python -DskipTests ``` -#### 目录结构 -• **wheel**: wheel文件位于 `tsfile/python/dist`, 你可以使用 pip install 命令来进行本地安装。 +* 如果没有安装 maven, 你可以执行下面的指令完成编译: -### 安装到本地 + * 在 Linux 或 Macos上: + ```shell + mvnw clean install -P with-python -DskipTests + ``` + * 在 Windows 上: -你可以执行 `pip install`命令来安装编译得到的 tsfile包(假设他的名字是 tsfile.wheel) + ```shell + mvnw.cmd clean install -P with-python -DskipTests + ``` + +* 编译成功后,wheel 文件将位于 `tsfile/python/dist` 目录下, 可通过 pip install 命令进行本地安装(假设他的名字是 tsfile.wheel) ```bash pip install tsfile.wheel ``` - ## 写入示例 ```Python @@ -149,6 +148,7 @@ with TsFileReader(table_data_dir) as reader: print(result.read_data_frame()) ``` + 使用 `to_dataframe` 读取 TsFile 为 Dataframe. ```Python @@ -158,8 +158,10 @@ table_data_dir = os.path.join(os.path.dirname(__file__), "table_data.tsfile") print(ts.to_dataframe(table_data_dir)) ``` + ## 示例代码 使用这些接口的示例代码可以在以下链接中找到:https://github.com/apache/tsfile/blob/develop/python/examples/example.py > 注意:以上读写示例均基于表模型接口,接口定义介绍可见[Python 接口定义](./InterfaceDefinition/InterfaceDefinition-Python.md)。若需了解树模型相关内容,请联系我们。 + diff --git a/src/zh/UserGuide/latest/QuickStart/QuickStart-PYTHON.md b/src/zh/UserGuide/latest/QuickStart/QuickStart-PYTHON.md index 4d24c4109..430a324ef 100644 --- a/src/zh/UserGuide/latest/QuickStart/QuickStart-PYTHON.md +++ b/src/zh/UserGuide/latest/QuickStart/QuickStart-PYTHON.md @@ -20,35 +20,11 @@ --> # 快速上手 - Python -## 依赖 +## 依赖安装 -如果需要在在本地编译,依赖如下所示: +### 使用 PIP 在线安装 -- CMake >=3.11 -- Maven >=3.9.6 -- GCC >=4.8.5 -- Make >=4.3 -- cython >= 3.0.10 -- numpy >= 1.26.4 -- pandas >= 2.2.2 -- setuptools >= 70.0.0 - -如果使用 Pip 在线安装 TsFile,依赖包如下: - -numpy >= 1.26.4 -pandas >= 2.2.2 - -## 安装 - -### 使用 PIP 进行在线安装 - -使用pip 指令来在线安装 TsFile 包 - -```bash -pip install tsfile -``` - -支持的架构平台如下: +1. 架构平台支持情况 | Platform | python | | ------------- | -------------------------------- | @@ -58,46 +34,69 @@ pip install tsfile | MacOS_X86_64 | py39, py310, py311, py312, py313 | | Win_amd64 | py39, py310, py311, py312, py313 | -或者直接下载 wheel 文件安装:https://pypi.org/project/tsfile/#files +2. 安装依赖版本要求 + * numpy >= 1.26.4 + * pandas >= 2.2.2 -### 在本地进行编译 +3. 安装步骤 -从git克隆源代码: +通过 pip 指令在线安装 -```shell -git clone https://github.com/apache/tsfile.git +```bash +pip install tsfile ``` -在 TsFile 根目录下执行 maven 编译: -```shell -mvn clean install -P with-python -DskipTests +### 下载 wheel 文件手动安装 + +1. 下载 wheel 文件:https://pypi.org/project/tsfile/#files +2. 通过 pip install 命令安装 wheel 文件 +```bash +pip install tsfile.wheel ``` -如果没有安装 maven, 你可以执行下面的指令完成编译: +### 源码编译安装 +1. 安装依赖版本要求 + + - CMake >=3.11 + - Maven >=3.9.6 + - GCC >=4.8.5 + - Make >=4.3 + - cython >= 3.0.10 + - numpy >= 1.26.4 + - pandas >= 2.2.2 + - setuptools >= 70.0.0 + +2. 安装步骤 +* 从git克隆源代码: -在 Linux 或 Macos上: ```shell -mvnw clean install -P with-python -DskipTests +git clone https://github.com/apache/tsfile.git ``` -在 Windows 上: +* 在 TsFile 根目录下执行 maven 编译: ```shell -mvnw.cmd clean install -P with-python -DskipTests +mvn clean install -P with-python -DskipTests ``` -#### 目录结构 -• **wheel**: wheel文件位于 `tsfile/python/dist`, 你可以使用 pip install 命令来进行本地安装。 +* 如果没有安装 maven, 你可以执行下面的指令完成编译: + + * 在 Linux 或 Macos上: + ```shell + mvnw clean install -P with-python -DskipTests + ``` + * 在 Windows 上: -### 安装到本地 + ```shell + mvnw.cmd clean install -P with-python -DskipTests + ``` -你可以执行 `pip install`命令来安装编译得到的 tsfile包(假设他的名字是 tsfile.wheel) +* 编译成功后,wheel 文件将位于 `tsfile/python/dist` 目录下, 可通过 pip install 命令进行本地安装(假设他的名字是 `tsfile.wheel`) ```bash pip install tsfile.wheel ``` - ## 写入示例 ```Python