converting pandas dataframes to spark dataframe in zeppelin

后端 未结 3 1907
南旧
南旧 2021-02-04 05:16

I am new to zeppelin. I have a usecase wherein i have a pandas dataframe.I need to visualize the collections using in-built chart of zeppelin I do not have a clear approach here

3条回答
  •  离开以前
    2021-02-04 05:28

    I've just copied and pasted your code in a notebook and it works.

    %pyspark
    import pandas as pd
    from pyspark.sql import SQLContext
    print sc
    df = pd.DataFrame([("foo", 1), ("bar", 2)], columns=("k", "v"))
    print type(df)
    print df
    sqlCtx = SQLContext(sc)
    sqlCtx.createDataFrame(df).show()
    
    
    
         k  v
    0  foo  1
    1  bar  2
    +---+-+
    |  k|v|
    +---+-+
    |foo|1|
    |bar|2|
    +---+-+
    

    I am using this version: zeppelin-0.5.0-incubating-bin-spark-1.4.0_hadoop-2.3.tgz

提交回复
热议问题