2016-07-04 11 views
-3

私は次のようになり、大きな(〜100万)のデータセットを持っている...Dataframe(python/pandas)の列から複数の行をプロットする?

Age Wavelength Luminosity 

1  96   100 
1  97   150 
1  98   100 
2  96.5   90 
2  97   160 
2  97.5   120 
... 

私は現在のデータフレームでそれを持っているし、すべての年齢層のための光度対波長をプロットしたいです。 1つのグラフで各年齢のプロットを取得するにはどうすればよいですか?

+0

を使用することができます。 http://programmers.stackexchange.com/にあなたの質問を掲示するのはどうですか? –

+1

@Andrés他のサイトを参照しているときは、[クロスポストが嫌になっている](http://meta.stackexchange.com/tags/cross-posting/info) – gnat

+2

これはリモートでも、プログラマーの話題は? –

答えて

0

あなたはこれがないstackoverflowの質問のように見えますpandas.core.groupby.DataFrameGroupBy.plot

In[1]: import pandas as pd 

In[2]: import numpy as np 

In[3]: dataset = pd.DataFrame({"Age": np.random.random_integers(1, 5, 100), "Wavelength": np.random.uniform(90, 100, 100), "Luminosity": np.random.random_integers(5, 15, 100) * 10}) 

In[4]: dataset.groupby("Age").plot(x="Wavelength", y="Luminosity", kind="scatter") 
Out[4]: 
Age 
1 Axes(0.125,0.1;0.775x0.8) 
2 Axes(0.125,0.1;0.775x0.8) 
3 Axes(0.125,0.1;0.775x0.8) 
4 Axes(0.125,0.1;0.775x0.8) 
5 Axes(0.125,0.1;0.775x0.8) 
dtype: object 
+0

ありがとう!これらをすべて1つのグラフに表示する方法はありますか? – Cmf55

+0

'plot'関数は' matplotlib'' AxesSubplot'オブジェクトを返します。ですから、 'matplotlib'サブプロットグリッドとこの軸オブジェクトで作業できます。私はそれを試していない。 –

関連する問題