Plotting multiple lines from columns of Dataframe (python/pandas)? -


i have large (~1 million) data set looks this...

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

i have in dataframe , want plot wavelength vs luminosity age groups. how plots each age on 1 graph?

you can use pandas.core.groupby.dataframegroupby.plot

in[1]: import pandas pd  in[2]: import numpy 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 

Comments

Popular posts from this blog

java - Static nested class instance -

c# - Bluetooth LE CanUpdate Characteristic property -

JavaScript - Replace variable from string in all occurrences -