• 文件 >
  • torcharrow.DataFrame
捷徑

torcharrow.DataFrame

torcharrow.DataFrame 是一個 Python DataFrame 函式庫(建構於 Apache Arrow 資料行記憶體格式),用於載入、聯結、聚合、過濾和處理數據。 torcharrow.DataFrame 也提供了一個類似 Pandas 的 API,能自然地融入 Python 機器學習生態系統,並且數據科學家和機器學習工程師都能熟悉使用,因此他們可以用它來表達機器學習中的表格數據工作流程,例如特徵工程、訓練和推論預處理。

DataFrame 類別和通用 API

class torcharrow.DataFrame
DataFrame.columns

DataFrame 的資料行標籤。

DataFrame.dtype

torcharrow.Column 的資料類型

DataFrame.device

torcharrow.Column 所在或將要配置的裝置。

DataFrame.length

返回包含空值的列數

DataFrame.head

返回前 n 列。

DataFrame.tail

返回最後 n 列。

DataFrame.describe

產生描述性統計數據。

DataFrame.drop

返回移除指定欄位後的 DataFrame。

DataFrame.rename

返回重新命名欄位的 DataFrame。

DataFrame.reorder

(實驗性 API)返回按指定順序排列欄位的 DataFrame。

DataFrame.append

返回附加值的欄位/DataFrame。

DataFrame.isin

檢查 DataFrame 中的每個元素是否包含在指定值中。

函數式 API

DataFrame.map

根據輸入的對應關係映射列。

DataFrame.filter

選擇謂詞為 True 的列。

DataFrame.flatmap

根據輸入的對應關係將列映射到列的列表,如果結果類型 != 項目類型,則需要指定資料類型。

DataFrame.transform

類似於 map(),但在每次調用時會處理一小批列。

關聯式 API

DataFrame.select

類似於 SQL 的 SELECT

DataFrame.where

類似於 SQL 的 where(不是 Pandas 的 where)

DataFrame.sort

以升序或降序排列欄位/DataFrame。

資料清理

DataFrame.fill_null

使用指定的方法填補空值。

DataFrame.drop_null

返回移除包含任何或所有空值的列/DataFrame。

DataFrame.drop_duplicates

(實驗性 API)從列/DataFrame 中移除重複值,但保留第一個、最後一個或無。

轉換

DataFrame.to_arrow

將自身轉換為 Arrow 表格

DataFrame.to_tensor

轉換為 PyTorch 容器(Tensor、PackedList、PackedMap 等)

DataFrame.to_pylist

轉換為原生 Python 容器(純量或容器的列表)

DataFrame.to_pandas

將自身轉換為 Pandas DataFrame

統計

DataFrame.min

返回每欄非空值的最小值。

DataFrame.max

返回每欄非空值的最大值。

DataFrame.sum

返回每欄非空值的總和。

DataFrame.mean

返回每欄非空值的平均值。

DataFrame.std

返回每欄非空值的標準差。

DataFrame.median

返回每欄非空值的中位數。

DataFrame.all

返回所有非空值元素是否都為 True

DataFrame.any

返回是否有任何非空值元素為 True

算術運算

DataFrame.log

傳回一個 DataFrame,其中每個元素的值為其自然對數。

文件

取得 PyTorch 完整的開發者文件

檢視文件

教學

取得適用於初學者和進階開發者的深入教學

檢視教學

資源

尋找開發資源並獲得問題解答

檢視資源