捷徑

torcharrow.Column

torcharrow.Column 是一個類似 torch.Tensor 的一維資料結構,包含單一資料類型的元素。它也支援非數值類型,例如字串、列表、結構。

資料類型

TorchArrow 為欄定義了以下資料類型,位於模組 torcharrow.dtypes 中(在下表中縮寫為 dt

資料類型

dtype

32 位元浮點數

dt.float32dt.Float32(nullable)

64 位元浮點數

dt.float64dt.Float64(nullable)

8 位元有號整數

dt.int8dt.Int8(nullable)

16 位元有號整數

dt.int16dt.Int16(nullable)

32 位元有號整數

dt.int32dt.Int32(nullable)

64 位元帶正負號整數

dt.int64dt.Int64(nullable)

布林值

dt.booleandt.Boolean(nullable)

字串

dt.stringdt.String(nullable)

列表

dt.List(item_dtype, nullable)

結構

dt.Struct(fields, nullable)

Column 類別參考

class torcharrow.Column
Column.dtype

torcharrow.Column 的資料類型

Column.device

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

Column.length

傳回包含空值的列數

Column.null_count

傳回空值的數量

Column.head

傳回前 n 列。

Column.tail

傳回最後 n 列。

Column.cast

將 Column 轉換為指定的 dtype

Column.is_valid_at

(實驗性 API) 傳回索引 i 處的資料是否有效,即非空值

Column.append

傳回附加值的欄/數據框。

Column.isin

檢查欄中的每個元素是否包含在值中。

Column.all

傳回所有非空元素是否為 True

Column.any

傳回任何非空元素是否為 True

Column.map

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

Column.filter

選擇述詞為 True 的列。

Column.flatmap

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

Column.transform

類似於 map(),但一次對多列的小批次調用可調用對象。

Column.fill_null

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

Column.drop_null

傳回已移除列/數據框,其中列具有任何或所有空值。

Column.drop_duplicates

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

Column.to_arrow

將自身轉換為 Arrow 陣列

Column.to_tensor

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

Column.to_pylist

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

Column.to_pandas

將自身轉換為 Pandas Series

NumericalColumn 類別參考

class torcharrow.NumericalColumn

NumericalColumn.abs

序列中每個元素的絕對值。

NumericalColumn.ceil

將每個值向上捨入到最小的整數

NumericalColumn.floor

將每個值向下捨入到最大的整數值

NumericalColumn.round

將數據中的每個值四捨五入到給定的小數位數。

NumericalColumn.log

傳回一個新欄位,其中包含元素的自然對數

NumericalColumn.describe

產生描述性統計。

NumericalColumn.min

傳回非空值的最小值。

NumericalColumn.max

傳回非空值的最大值。

NumericalColumn.sum

傳回非空值的總和。

NumericalColumn.mean

傳回非空值的平均值。

NumericalColumn.std

傳回資料的標準差。

NumericalColumn.median

傳回資料中值的中位數。

StringColumn 類別參考

class torcharrow.StringColumn

istring_column.StringMethods.length

計算欄位中每個元素的長度。

istring_column.StringMethods.slice

從欄位中的每個元素擷取子字串。

istring_column.StringMethods.split

根據給定的分隔符號/分隔符號分割字串。

istring_column.StringMethods.strip

移除前導和尾隨空格。

istring_column.StringMethods.isalpha

如果字串是字母字串,則傳回 True,否則傳回 False。

istring_column.StringMethods.isnumeric

如果所有字元都是數字,則傳回 True,否則傳回 False。

istring_column.StringMethods.isalnum

如果字串中的所有字元都是字母數字(字母或數字),則傳回 True,否則傳回 False。

istring_column.StringMethods.isdigit

如果字串中的所有字元都是數字,則傳回 True,否則傳回 False。

istring_column.StringMethods.isdecimal

如果字串僅包含十進位數字(從 0 到 9),則傳回 True,否則傳回 False。

istring_column.StringMethods.isspace

如果字串中的所有字元都是空格,則傳回 True,否則傳回 False。

istring_column.StringMethods.islower

如果非空字串是小寫,則傳回 True,否則傳回 False。

istring_column.StringMethods.isupper

如果非空字串是大寫,則傳回 True,否則傳回 False。

istring_column.StringMethods.istitle

如果字串的每個單字都以大寫字母開頭,則傳回 True,否則傳回 False。

istring_column.StringMethods.lower

將欄位中的字串轉換為小寫。

istring_column.StringMethods.upper

將欄位中的字串轉換為大寫。

istring_column.StringMethods.startswith

測試每個字串元素的開頭是否符合特定模式。

istring_column.StringMethods.endswith

測試每個字串元素的結尾是否符合特定模式。

istring_column.StringMethods.count

計算欄位中每個字串的模式出現次數。

istring_column.StringMethods.find

返回欄位中每個字串的最小索引值。

istring_column.StringMethods.replace

替換欄位中每個模式的出現位置。

istring_column.StringMethods.match

判斷每個字串是否符合正規表達式。

istring_column.StringMethods.contains

測試每個項目,判斷模式是否包含在字串中;返回布林值。

istring_column.StringMethods.findall

針對每個項目,查找所有出現的模式 (參見 re.findall())。

ListColumn 類別參考

class torcharrow.ListColumn

ilist_column.ListMethods.length

計算欄位中每個元素的長度。

ilist_column.ListMethods.slice

從欄位中的每個元素切出子列表。

ilist_column.ListMethods.vmap

(實驗性 API)向量化映射。

文件

存取 PyTorch 的完整開發人員文件

檢視文件

教學課程

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

檢視教學課程

資源

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

檢視資源