Visualization of Exoplanet Data using Python

by Yanal Kashou

This is a free dataset of exoplanets from the RDatasets.

The data was obtained from the URLs below of the .csv data file and the .html documentation file, respectively:

Read in the Dataset


In [1]:
import pandas as pd
planets = pd.read_csv("planets.csv")

Brief Exploration


In [8]:
planets.head(3)


Out[8]:
Unnamed: 0 mass period eccen
0 1 0.120 4.950 0.00
1 2 0.197 3.971 0.00
2 3 0.210 44.280 0.34

In [14]:
planets = planets.rename(columns = {'Unnamed: 0':'Number'})
planets.shape


Out[14]:
(101, 4)

In [19]:
planets.describe()


Out[19]:
Number mass period eccen
count 101.000000 101.000000 101.000000 101.000000
mean 51.000000 3.327287 666.531252 0.281548
std 29.300171 3.680601 873.749838 0.210943
min 1.000000 0.050000 2.985000 0.000000
25% 26.000000 0.930000 44.280000 0.100000
50% 51.000000 1.760000 337.110000 0.270000
75% 76.000000 4.140000 1089.000000 0.410000
max 101.000000 17.500000 5360.000000 0.927000

In [70]:
p25 = planets.sample(n=25)
p25 = p25.drop('Number', 1)
p25


Out[70]:
mass period eccen
65 3.320 267.20000 0.230
40 1.282 7.12620 0.134
6 0.340 2.98500 0.080
19 0.880 221.60000 0.540
2 0.210 44.28000 0.340
100 17.500 256.03000 0.429
56 2.080 228.52000 0.304
15 0.685 3.52433 0.000
36 1.150 2614.00000 0.000
88 7.700 58.11600 0.529
22 0.900 1136.00000 0.330
50 1.830 454.00000 0.200
13 0.560 30.12000 0.270
27 0.990 872.30000 0.280
30 1.010 540.40000 0.520
76 4.270 1764.00000 0.353
39 1.240 435.60000 0.450
10 0.480 3.48700 0.050
53 1.990 743.00000 0.620
85 7.390 1582.00000 0.478
42 1.550 51.61000 0.649
31 1.010 1942.00000 0.400
77 4.290 1308.50000 0.310
11 0.480 22.09000 0.300
72 4.000 15.78000 0.046

Plotting with PyPlot and Seaborn

Hexbin Plot


In [55]:
import matplotlib.pyplot as plt
import numpy as np
from scipy.stats import kendalltau
import seaborn as sns
sns.set(style="ticks")

sns.jointplot(planets.period, planets.eccen, kind="hex", stat_func=kendalltau, color="blue")
plt.show()


Density Plot


In [62]:
sns.kdeplot(planets.period, planets.eccen)
plt.show()


Simple Scatter Plot


In [72]:
sns.lmplot('mass', 'eccen', data=planets, fit_reg=False)
plt.show()