You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

cameo-table

Package Overview
Dependencies
Maintainers
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cameo-table

modify table file, and save modified file result

1.0.3
pipPyPI
Maintainers
2

安裝(installation)

pip install cameo_table

CLI 使用(CLI Usage (Chinese Only) )

python -m cameo_table

選擇想要的功能
輸入1:挑選出指定欄位為某值的所有列
輸入2:將直欄轉換為橫向資料
輸入0:離開

輸入1:挑選出指定欄位為某值的所有列

以空白隔開 請依序輸入:
要處理的檔名(路徑/url)
指定值所在的欄位
指定的值
輸出的檔名(路徑)

path/to/original/file column_to_find_value value path/to/result/file

舉例 (example)

原始檔案內容 (orginal file content)

other_datacolumn_to_find_value
a1
b2
c3
d1
e2
f3

在終端機輸入以下參數 (input following arguments to terminal)

> python -m cameo_table
選擇想要的功能 輸入1:挑選出指定欄位為某值的所有列 輸入2:將直欄轉換為橫向資料 輸入0:離開
1
已選功能1:挑選出指定欄位為某值的所有列
以空白隔開 請依序輸入:要處理的檔名(路徑/url) 指定值所在的欄位 指定的值 輸出的檔名(路徑)
path/to/original/file column_to_find_value 3 path/to/result/file

結果檔案內容 (result file content)

other_datacolumn_to_find_value
c3
f3

輸入2:將直欄轉換為橫向資料

以空白隔開 請依序輸入: 要處理的檔名(路徑/url)
轉換為欄位標題的欄位
傳換為對應值的欄位
輸出的檔名(路徑)

path/to/original/file column_to_transform_as_column_label column_to_transform_as_value path/to/result/file

舉例 (example)

原始檔案內容 (orginal file content)

other_datalabelvalue
Aa1
Ab2
Ac3
Ba4
Bb5
Cb6

在終端機輸入以下參數 (input following arguments to terminal)

> python -m cameo_table
選擇想要的功能 輸入1:挑選出指定欄位為某值的所有列 輸入2:將直欄轉換為橫向資料 輸入0:離開
2
已選功能2:將直欄轉換為橫向資料
以空白隔開 請依序輸入:要處理的檔名(路徑/url) 轉換為欄位標題的欄位 對應值所在的欄位 輸出的檔名(路徑)
path/to/original/file label value path/to/result/file

結果檔案內容 (result file content)

other_dataabc
A123
B45
C6

輸入3:文件尚未完成

...

Python 使用 (Python usage)

引入函式庫 (import module)

import cameo_table

v0.2.1 舊版程式碼(old version v0.2.1 of code usage, not updated to v1.0.3 yet)

cameo_table.pick_row_contain_certain_value()

cameo_table.pick_rows_contain_certain_value(
    path: str or df,
    col_to_apply_on: str,
    value,
    result_path: str
)

參數 (arguments):

參數名
(Name)
類型
(Type)
意義
(Meaning)
pathstr待處理檔案的路徑
(path of the file to handle with)
DataFrame待處理的DataFrame
(DataFrame to handle with)
col_to_apply_onstr要找到某值的欄位名稱
(name of the column to find value)
value-在某欄要找到的值
(value to be picked in the column)
result_pathstr結果檔案的路徑
(path to the result file)

舉例 (example)

原始檔案內容 (orginal file content)

other_datacolumn_to_find_value
a1
b2
c3
d1
e2
f3

使用以下程式碼 (use following codes)

import cameo_table
cameo_table.pick_rows_contain_certain_value(
    path = 'path/to/original/file',
    col_to_apply_on = 'column_to_find_value',
    value = 3,
    result_path = 'path/to/result/file')

結果檔案內容 (result file content)

other_datacolumn_to_find_value
c3
f3

cameo_table.turn_vertical_to_horizontal()

cameo_table.turn_vertical_to_horizontal(
    path: str or df,
    col_to_apply_on: str,
    value,
    result_path: str
)

參數 (arguments):

參數名
(Name)
類型
(Type)
意義
(Meaning)
pathstr待處理檔案的路徑
(path of the file to handle with)
DataFrame待處理的DataFrame
(DataFrame to handle with)
col_to_apply_onstr要轉換成欄位標題的欄位
(column to transform as column label)
valuestr轉換為對應值的欄位
(column_to_transform_as_value)
result_pathstr結果檔案的路徑
(path to the result file)

舉例 (example)

原始檔案內容 (orginal file content)

other_datalabelvalue
Aa1
Ab2
Ac3
Ba4
Bb5
Cb6

使用以下程式碼 (use following codes)

import cameo_table
cameo_table.turn_vertical_to_horizontal(
    path = 'path/to/original/file',
    col_to_apply_on = 'label',
    value = 'value',
    result_path = 'path/to/result/file')

結果檔案內容 (result file content)

other_dataabc
A123
B45
C6

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts