Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

To select a column from the database table, we first need to make our dataframe accessible in our SQL queries. To do this, we call the df.createOrReplaceTempView method and set the temporary view name to insurance_df.

df.createOrReplaceTempView("insurance_df")

df2 = spark.sql("SELECT AGE, SEX FROM insurance_df")
df2.show()
Comment

To select a column from the database table, we first need to make our dataframe accessible in our SQL queries. To do this, we call the df.createOrReplaceTempView method and set the temporary view name to insurance_df.

df.createOrReplaceTempView("insurance_df")

df2 = spark.sql("SELECT AGE, SEX FROM insurance_df")
df2.show()
Comment

PREVIOUS NEXT
Code Example
Python :: Filling or replacing the missing values with mode 
Python :: Tree : Top View 
Python :: 100 days of python 
Python :: django wsgi application could not be loaded error importing module 
Python :: 1041 uri solution 
Python :: 1043 uri solution 
Python :: newton backward interpolation python code 
Python :: Create list element using algebraic operation 
Python :: Python 0 evaluates to False 
Python :: basic decorator example 
Python :: extract metadata from xml tei file python 
Python :: how to give order in boxplot matplotlib 
Python :: quoto x discord selfbot 
Python :: pydrive download file 
Python :: python multiline code dot 
Python :: What is the purpose of open ( ) and close ( ) in os 
Python :: django test postgres extensions intarray 
Python :: part of list into dataframe 
Python :: how to def a variable in python 
Python :: python measure volum from audio file 
Python :: discord.py delete own message 
Python :: djangobook.com jwd django restfremwork plugin 
Python :: Return a new RDD by applying a function to each element of this RDD. 
Python :: data exfiltration icmp 
Python :: randian angle to degrees using numpy 
Python :: mask and then fillnan# 
Python :: hashing in python using quadratic probing 
Python :: remove grid from 3d plots 
Python :: get a liste from a txt file python 
Python :: how to convert exe file to python file 
ADD CONTENT
Topic
Content
Source link
Name
4+4 =