Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
81 views
in Technique[技术] by (71.8m points)

python - How can I make the values from Field 1 the column headers and the values from Field 2 the values associated with the new Field headers?

I have a .csv file that has 2 fields. How can I make the values from one of the fields the column headers and the values from the other field the values associated with the column headers?

Field Header 1 is currently named: Attributes, Field Header 2 is currently named: Values. I want to flip this around so that the values in the Attribute field are now the Field Headers and the values in the Value field become the values associated with each header.

Thanks.

.csv file

question from:https://stackoverflow.com/questions/65838592/how-can-i-make-the-values-from-field-1-the-column-headers-and-the-values-from-fi

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Sorry, it’s a python question. I found the answer by using the transpose function.

Thanks


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...