[Python] A memo to write CSV vertically with Pandas

Conclusion

import pandas as pd

n0 = ["a", "b", "c"]
n1 = ["aa", "bb", "cc", "dd", "ee", "ff", "gg"]
n2 = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]

nn = [n0, n1, n2]
print(nn)

df = pd.DataFrame(nn)
df = df.T

print(df)

savefile = "testcsv.csv"
df.to_csv(savefile, encoding="utf_8_sig")

Recommended Posts

[Python] A memo to write CSV vertically with Pandas
Write to csv with Python
[Python] Write to csv file with Python
How to read a CSV file with Python 2/3
Write CSV data to AWS-S3 with AWS-Lambda + Python
I want to write to a file with Python
Read csv with python pandas
A memo connected to HiveServer2 of EMR with python
How to convert JSON file to CSV file with Python Pandas
Make a CSV formatting tool with Python Pandas PyInstaller
A program to write Lattice Hinge with Rhinoceros with Python
How to write a Python class
Write a batch script with Python3.5 ~
Convert memo at once with Python 2to3
Memo to ask for KPI with python
[Python] A memo that I tried to get started with asyncio
A memo with Python2.7 and Python3 on CentOS
[Python] A memo to operate ROM created by GBDK with PyBoy
Write a TCP client with Python Twisted
[Part1] Scraping with Python → Organize to csv!
Read and format a csv file mixed with comma tabs with Python pandas
A memo that allows you to change Pineapple's Python environment with pyenv
[Python / Pandas] A bug occurs when trying to replace a DataFrame with `None` with` replace`
A memo corresponding to Django's runserver moss in Python 2.7.11 entered with Homebrew
[Python] How to read a csv file (read_csv method of pandas module)
[Introduction to Python] How to write a character string with the format function
Scraping tabelog with python and outputting to CSV
Send a message to LINE with Python (LINE Notify)
Read Python csv data with Pandas ⇒ Graph with Matplotlib
[Python] Road to a snake charmer (6) Manipulate Pandas
Try to draw a life curve with python
[Python] How to read excel file with pandas
[Write to map with plotly] Dynamic visualization with plotly [python]
Try to make a "cryptanalysis" cipher with Python
Decide to assign a laboratory with Python (fiction)
Why does Python have to write a colon?
A memo when creating a python environment with miniconda
Steps to create a Twitter bot with python
Try to make a dihedral group with Python
A layman wants to get started with Python
Convert 202003 to 2020-03 with pandas
Csv tinkering with python
Searching for an efficient way to write a Dockerfile in Python with poetry
[Python] How to run Jupyter-notebook + pandas + multiprocessing (Pool) [pandas] Memo
How to convert / restore a string with [] in python
[Python] How to draw a line graph with Matplotlib
Try to make a command standby tool with python
Python Ver. To introduce WebPay with a little code.
I tried to touch the CSV file with Python
I tried to draw a route map with Python
I want to write in Python! (2) Let's write a test
Introduction to Mathematics Starting with Python Study Memo Vol.1
How to output CSV of multi-line header with pandas
I want to work with a robot in python.
From buying a computer to running a program with python
Write multiple records to DynamoDB with Lambda (Python, JavaScript)
[Python] How to write a docstring that conforms to PEP8
I tried to automatically generate a password with Python3
How to save a table scraped by python to csv
For those who want to write Python with vim
A memo that I touched the Datastore with python