title: how to store Pyspark dataframe into HBase
body: <p>I have a code that converts Pyspark streaming data to dataframe. I need to store this dataframe into Hbase. Help me to write code additionally.   </p>
  
  
  
  <pre class="lang-py prettyprint-override"><code>import sys
  from pyspark import SparkContext
  from pyspark.streaming import StreamingContext
  from pyspark.sql import Row, SparkSession
  
  def getSparkSessionInstance(sparkConf):
  if ('sparkSessionSingletonInstance' not in globals()):
      globals()['sparkSessionSingletonInstance'] = SparkSession\
          .builder\
          .config(conf=sparkConf)\
          .getOrCreate()
  return globals()['sparkSessionSingletonInstance']
  
  
  if __name__ == "__main__":
  if len(sys.argv) != 3:
      print("Usage: sql_network_wordcount.py &lt;hostname&gt; &lt;port&gt; ", 
  file=sys.stderr)
      exit(-1)
  host, port = sys.argv[1:]
  sc = SparkContext(appName="PythonSqlNetworkWordCount")
  ssc = StreamingContext(sc, 1)
  lines = ssc.socketTextStream(host, int(port))
  
  def process(time, rdd):
      print("========= %s =========" % str(time))
  
      try:
          words = rdd.map(lambda line :line.split(" ")).collect()
          spark = getSparkSessionInstance(rdd.context.getConf())
          linesDataFrame = spark.createDataFrame(words,schema=["lat","lon"])
  
          linesDataFrame.show()
  except :
  pass
  
  lines.foreachRDD(process)
  ssc.start()
  ssc.awaitTermination()
  </code></pre>