Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

how to add row in spark dataframe

# Create hard coded row
unknown_list = [[‘0’, ‘Unknown’]]
# turn row into dataframe
unknown_df = spark.createDataFrame(unknown_list)
# union with existing dataframe
df = df.union(unknown_df)
Comment

PREVIOUS NEXT
Code Example
Python :: python show only 1st element of nested lists 
Python :: spyder 3.3.6 requires pyqtwebengine<5.13; python_version = "3", which is not installed. 
Python :: plotly backend pandas 
Python :: Find faculty of a number python 
Python :: remove spaces from a list python 
Python :: iris dataset python import 
Python :: proper tree in data structure 
Python :: drop row based on NaN value of a column 
Python :: copy a file from one directroy to other using python 
Python :: how to count non null values in pandas 
Python :: python for loop max iterations 
Python :: click link selenium python 
Python :: python way to unindent blocks of code 
Python :: c vs python 
Python :: reload function jupyter notebook 
Python :: set select group of columns to numeric pandas 
Python :: python count hex 
Python :: initialize array of natural numbers python 
Python :: pynput left click command 
Python :: how to get column names having numeric value in pandas 
Python :: python no such file python3 
Python :: remove columns that contain certain names in pandas 
Python :: python dictionary to csv 
Python :: read a large dataframe in pandas 
Python :: pandas shift columns down until value 
Python :: python defaultdict 
Python :: encryption python 
Python :: python typed list 
Python :: shutil move overwrite 
Python :: how to do an if input = python 
ADD CONTENT
Topic
Content
Source link
Name
4+2 =