Sono nuovo a pandas
e matplotlib
. non poteva in grado di ottenere esatto riferimento per tracciare la mia DataFrame
cui schema è il seguenteCome tracciare la trama/trama 3d dal dataframe?
schema = StructType([
StructField("x", IntegerType(), True),
StructField("y", IntegerType(), True),
StructField("z", IntegerType(), True)])
Come per tracciare grafico 3d w.r.t. x, yez
Ecco il codice di esempio ho usato
import matplotlib.pyplot as pltt
dfSpark = sqlContext.createDataFrame(tupleRangeRDD, schema) // reading as spark df
df = dfSpark.toPandas()
fig = pltt.figure();
ax = fig.add_subplot(111, projection='3d')
ax.plot_surface(df['x'], df['y'], df['z'])
sto ottenendo un diagramma grafico vuoto. sicuramente manca qualcosa. Qualche indicazione?
-Thx
Richiesta-1: Stampa df
def print_full(x):
pd.set_option('display.max_rows', len(x))
print(x)
pd.reset_option('display.max_rows')
print_full(df)
Risultato della top 10
x y z
0 301 301 10
1 300 301 16
2 300 300 6
3 299 301 30
4 299 300 20
5 299 299 14
6 298 301 40
7 298 300 30
8 298 299 24
9 298 298 10
10 297 301 48
Does df contenere qualsiasi cosa? In tal caso, puoi stampare df.head (n = 10) nella tua domanda? – giosans
aggiorna la mia domanda con la stampa df – mohan