Convert list to DataFrame with python

I often forget it, so make a note

import pandas as pd

# list
files=['a.txt', 'b.jpg', 'c.cvs', 'd.xls']

print(type(files))

#Convert to data frame
files_df = pd.DataFrame({'files':files})
print(files_df)
print(type(files_df))

result

<class 'list'>
   files
0  a.txt
1  b.jpg
2  c.cvs
3  d.xls
<class 'pandas.core.frame.DataFrame'>

Recommended Posts

Convert list to DataFrame with python
[Python] Convert list to Pandas [Pandas]
Convert strings to character-by-character list format with python
Python> list> Convert double list to single list
Convert memo at once with Python 2to3
[Python] How to convert a 2D list to a 1D list
Convert Excel data to JSON with python
Convert Hiragana to Romaji with Python (Beta)
Convert FX 1-minute data to 5-minute data with Python
python> Convert tuple to list> aList = list (pi_tuple)
Convert HEIC files to PNG files with Python
Convert Chinese numerals to Arabic numerals with Python
Sample to convert image to Wavelet with Python
Convert 202003 to 2020-03 with pandas
Initialize list with python
Convert PDF to image (JPEG / PNG) with Python
Convert PDFs to images in bulk with Python
Convert svg file to png / ico with Python
Convert Windows epoch values to date with python
Read CSV file with Python and convert it to DataFrame as it is
Connect to BigQuery with Python
[python] Convert date to string
Convert numpy int64 to python int
[Python] How to use list 1
Connect to Wikipedia with Python
Convert Scratch project to Python
[Python] Convert Shift_JIS to UTF-8
Switch python to 2.7 with alternatives
Write to csv with Python
[Introduction to Python] <list> [edit: 2020/02/22]
Convert python 3.x code to python 2.x
How to convert / restore a string with [] in python
Convert the image in .zip to PDF with Python
How to convert JSON file to CSV file with Python Pandas
PyInstaller memorandum Convert Python [.py] to [.exe] with 2 lines
[Python learning part 3] Convert pandas DataFrame, Series, and standard List to each other
Convert .ipynb to .html (with BatchFile)
Python: How to use async with
Convert from Pandas DataFrame to System.Data.DataTable using Python for .NET
Link to get started with python
Convert markdown to PDF in Python
How to convert an array to a dictionary with Python [Application]
[Python] Write to csv file with Python
Create folders from '01' to '12' with python
Nice to meet you with python
Try to operate Facebook with Python
Output to csv file with Python
Workflow to convert formula (image) to python
MP3 to WAV conversion with Python
Convert sentences to vectors with gensim
To do tail recursion with Python2
Convert images to sepia toning with PIL (Python Imaging Library)
How to get started with Python
What to do with PYTHON release?
[Python] How to use list 3 Added
Unable to install Python with pyenv
How to use FTP with Python
[Python] Convert natural numbers to ordinal numbers
[Python] list
How to calculate date with python
Get Redmine User list with DataFrame