Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

dataframe from lists

#import module
import pandas as pd

#have your data as a list of lists - they will each be a ROW
data = [['Stanley', 10, 'blue'],
		['Kyle', 9, 'green'],
        ['Kenny', 10, 'orange'],
        ['Cartman', 10, 'turquoise']]

#convert to Dataframe specifying columns names
df = pd.DataFrame(data, columns=['Name','Age','Hat Color'])
Comment

list of dataframe to dataframe

import pandas as pd
df = pd.concat(list_of_dataframes)
# easy way
Comment

list from dataframe python

col_one_list = df['one'].tolist()

col_one_arr = df['one'].to_numpy()
Comment

PREVIOUS NEXT
Code Example
Python :: how to mention someone discord.py 
Python :: how to print memory address in python 
Python :: math in python 
Python :: youtube bot python 
Python :: how to print from a python list 
Python :: py scrapy 
Python :: how to add virtual environment in vscode 
Python :: How to use path in Django Python 
Python :: games made with python 
Python :: py convert binary to int 
Python :: how to read frame width of video in cv2 
Python :: df read csv 
Python :: how to check list is empty or not 
Python :: how to duplicate a row in python 
Python :: transformer in pytorch 
Python :: max of a list in python 
Python :: pandas remove duplicates 
Python :: vstack numpy 
Python :: new line 
Python :: how to sleep() in python 
Python :: how to watermark a video using python 
Python :: how to make a calculator in python 
Python :: Numpy split array into chunks of equal size 
Python :: ten minute mail 
Python :: python print binary tree 
Python :: Dependency on app with no migrations: 
Python :: coding 
Python :: python subprocess no such file or directory 
Python :: sublime autocomplete python 
Python :: list append string 
ADD CONTENT
Topic
Content
Source link
Name
8+9 =