Diysb Tools

转置 CSV

只需使用下方表格上传您的 CSV 文件,此工具就会自动转置您的 CSV 文件。在工具选项中,您可以指定 CSV 文件中注释行的起始字符,以将其移除。此外,如果 CSV 文件不完整(缺少值),您可以使用空字符或自定义字符替换缺失值。

CSV 工具

What is a 转置 CSV?

此工具用于转置逗号分隔值 (CSV)。它将 CSV 视为数据矩阵,并将所有元素沿主对角线翻转。输出包含与输入相同的 CSV 数据,但现在所有行都变成了列,所有列都变成了行。转置后,CSV 文件的尺寸将相反。例如,如果输入文件有 4 列 3 行,则输出文件将有 3 列 4 行。在转换过程中,程序还会清除数据中不必要的行,并更正不完整的数据。具体来说,该工具会自动删除所有以特定字符开头的空记录和注释,您可以在选项中设置这些字符。此外,如果 CSV 数据损坏或丢失,该实用程序会使用空字段或自定义字段(可在选项中指定)来填充文件。CSV 真是太棒了!

Input CSV
Transposed CSV
工具选项
CSV input Options
Enter the character used to delimit columns in the CSV input file.
Enter the quote character used to quote the CSV input fields.
Enter the character indicating the start of a comment line.
Fixing CSV Options

Insert empty fields or custom values where the CSV data is missing.

转置 CSV 示例

Transpose a 2x3 CSV

This example transposes a CSV with 2 rows and 3 columns. The tool splits the input data by the comma character, creating a 2 by 3 matrix. It then exchanges elements, turning columns into rows and vice versa. The output is a transposed CSV with flipped dimensions

foo,bar,baz val1,val2,val3
foo,bar,baz val1,val2,val3
foo,val1 bar,val2 baz,val3
foo,val1 bar,val2 baz,val3
CSV input Options
Enter the character used to delimit columns in the CSV input file.
Enter the quote character used to quote the CSV input fields.
Enter the character indicating the start of a comment line.
Fixing CSV Options

Insert empty fields or custom values where the CSV data is missing.

Transpose a Long CSV

In this example, we flip a vertical single-column CSV file containing a list of our favorite fruits and their emojis. This single column is transformed into a single-row CSV file and the rows length matches the height of the original CSV.

Tasty Fruit 🍑 peaches 🍒 cherries 🥝 kiwis 🍓 strawberries 🍎 apples 🍐 pears 🥭 mangos 🍍 pineapples 🍌 bananas 🍊 tangerines 🍉 watermelons 🍇 grapes
Tasty Fruit 🍑 peaches 🍒 cherries 🥝 kiwis 🍓 strawberries 🍎 apples 🍐 pears 🥭 mangos 🍍 pineapples 🍌 bananas 🍊 tangerines 🍉 watermelons 🍇 grapes
fTasty Fruit,🍑 peaches,🍒 cherries,🥝 kiwis,🍓 strawberries,🍎 apples,🍐 pears,🥭 mangos,🍍 pineapples,🍌 bananas,🍊 tangerines,🍉 watermelons,🍇 grapes
fTasty Fruit,🍑 peaches,🍒 cherries,🥝 kiwis,🍓 strawberries,🍎 apples,🍐 pears,🥭 mangos,🍍 pineapples,🍌 bananas,🍊 tangerines,🍉 watermelons,🍇 grapes
CSV input Options
Enter the character used to delimit columns in the CSV input file.
Enter the quote character used to quote the CSV input fields.
Enter the character indicating the start of a comment line.
Fixing CSV Options

Insert empty fields or custom values where the CSV data is missing.

Clean and Transpose CSV Data

In this example, we perform three tasks simultaneously: transpose a CSV file, remove comments and empty lines, and fix missing data. The transposition operation is the same as flipping a matrix across its diagonal and it is done automatically by the program. Additionally, the program automatically removes all empty lines as they cannot be transposed. The comments are removed by specifying the "#" symbol in the options. The program also fixes missing data using a custom bullet symbol "•", which is specified in the options.

Fish Type,Color,Habitat Goldfish,Gold,Freshwater #Clownfish,Orange,Coral Reefs Tuna,Silver,Saltwater Shark,Grey,Saltwater Salmon,Silver
Fish Type,Color,Habitat Goldfish,Gold,Freshwater #Clownfish,Orange,Coral Reefs Tuna,Silver,Saltwater Shark,Grey,Saltwater Salmon,Silver
Fish Type,Goldfish,Tuna,Shark,Salmon Color,Gold,Silver,Grey,Silver Habitat,Freshwater,Saltwater,Saltwater,•
Fish Type,Goldfish,Tuna,Shark,Salmon Color,Gold,Silver,Grey,Silver Habitat,Freshwater,Saltwater,Saltwater,•
CSV input Options
Enter the character used to delimit columns in the CSV input file.
Enter the quote character used to quote the CSV input fields.
Enter the character indicating the start of a comment line.
Fixing CSV Options

Insert empty fields or custom values where the CSV data is missing.

Enter the character used to fill missing values.