मैं pandas
और matplotlib
पर नया हूं। प्लॉट करने के लिए सही संदर्भ प्राप्त करने में सक्षम नहीं किया जा सका मेरी DataFrame
जिसका स्कीमा के रूप मेंडेटाफ्रेम से प्लॉट/3 डी प्लॉट कैसे सतह पर रखें?
schema = StructType([
StructField("x", IntegerType(), True),
StructField("y", IntegerType(), True),
StructField("z", IntegerType(), True)])
की तरह 3 डी ग्राफ w.r.t. प्लॉट करने के लिए इस प्रकार है एक्स, वाई और जेड
यहाँ नमूना कोड मैं इस्तेमाल किया
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'])
मैं एक खाली ग्राफ साजिश हो रही है है। निश्चित रूप से कुछ याद आ रही है। कोई संकेतक?
-Thx
अनुरोध-1: प्रिंट df शीर्ष 10 की
def print_full(x):
pd.set_option('display.max_rows', len(x))
print(x)
pd.reset_option('display.max_rows')
print_full(df)
परिणाम
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
df कुछ भी बताया गया है? यदि हां, तो क्या आप अपने प्रश्न में df.head (n = 10) प्रिंट कर सकते हैं? – giosans
प्रिंटिंग डीएफ के साथ मेरा प्रश्न अपडेट करें – mohan