Guest User

Untitled

a guest
Jan 19th, 2019
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. import pandas as pd
  2.  
  3. #create a pandas df from some data
  4. df = pd.read_csv("some/data/test_v2.csv")
  5.  
  6. #if SparkContext is not already initialized, run the next line
  7. #sc = SparkContext(conf=conf)
  8.  
  9. #create a SQLContext
  10. sqlc = SQLContext(sc)
  11.  
  12. #pass pandas dataframe into createDataFrame() function of SQLContext
  13. sdf = sqlc.createDataFrame(df)
Add Comment
Please, Sign In to add comment