Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

pandas empty dataframe with column names

# Create empty dataframe with column names
df = pd.DataFrame(columns=['dog_name','dog_age']) 
# Create some Lists to populate df
dogNames = ['Blue','Atticus'] 
dogAges = [2,8] 
# loop through the lists
for n in range(0,1): 
	df.loc[n] = [dogNames[n], dogAges[n]] 
Comment

blank dataframe with column names

df = pd.DataFrame(columns = column_names)
Comment

PREVIOUS NEXT
Code Example
Python :: python set cwd to file location 
Python :: install curses python 
Python :: how to remember to put a semicolon after your code 
Python :: python get how many days in current month 
Python :: python write to command prompt 
Python :: pandas uniqe values in the columns 
Python :: python program to shutdown computer when user is not present 
Python :: numpy compare arrays 
Python :: rotate x label 90 degrees seaborn 
Python :: power set python 
Python :: save and load a dictionary python 
Python :: python multiply list by scalar 
Python :: python half of string 
Python :: matplotlib label axis 
Python :: SettingWithCopyWarning 
Python :: check string similarity python 
Python :: user agents list 
Python :: create new django app 
Python :: concat dataFrame without index reset 
Python :: torch save state dict 
Python :: python loop through directory 
Python :: how to move a button lower on a gui tkinter 
Python :: unimport library python 
Python :: pytesseract tesseract is not installed 
Python :: python read csv 
Python :: python print only 2 decimals 
Python :: django admin prefetch_related 
Python :: python check my gpu 
Python :: how to ask for input in python 
Python :: tkinter boilerplate 
ADD CONTENT
Topic
Content
Source link
Name
3+4 =