Elements and the periodic table

This data came from Penn State CS professor Doug Hogan.

Thanks to UCF undergraduates Sam Borges, for finding the data set, and Lissa Galguera, for formatting it.


In [1]:
# Import modules that contain functions we need
import pandas as pd
import numpy as np
%matplotlib inline
import matplotlib.pyplot as plt

Getting the data


In [2]:
# Read in data that will be used for the calculations.
# The data needs to be in the same directory(folder) as the program
# Using pandas read_csv method, we can create a data frame
data = pd.read_csv("./data/elements.csv")

# If you're not using a Binder link, you can get the data with this instead:
#data = pd.read_csv("http://php.scripts.psu.edu/djh300/cmpsc221/pt-data1.csv")"

In [3]:
# displays the first several rows of the data set
data.head()


Out[3]:
Atomic Number Symbol Name Atomic Mass (au or g/mol) CPK Color (RRGGBB Hex Format) Electronic Configuration Electronegativity (Pauling) Atomic Radius (pm) Ion Radius (pm) Van der Waals Radius (pm) ... Oxidation States Standard State Bonding Type Melting Point (K) Boiling Point (K) Density (g/mL) Metal or Nonmetal Year Discovered Mass Radius of Ion
0 1 H Hydrogen 1.00794(4) FFFFFF 1s1 2.20 37.0 NaN 120.0 ... -1, 1 gas diatomic 14 20 8.99E-05 nonmetal 1766 1.007940 NaN
1 2 He Helium 4.002602(2) D9FFFF 1s2 NaN 32.0 NaN 140.0 ... NaN gas atomic NaN 4 0 noble gas 1868 4.002602 NaN
2 3 Li Lithium 6.941(2) CC80FF [He] 2s1 0.98 134.0 76 (+1) 182.0 ... 1 solid metallic 454 1615 0.54 alkali metal 1817 6.941000 76.0
3 4 Be Beryllium 9.012182(3) C2FF00 [He] 2s2 1.57 90.0 45 (+2) NaN ... 2 solid metallic 1560 2743 1.85 alkaline earth metal 1798 9.012182 45.0
4 5 B Boron 10.811(7) FFB5B5 [He] 2s2 2p1 2.04 82.0 27 (+3) NaN ... 1, 2, 3 solid covalent network 2348 4273 2.46 metalloid 1807 10.811000 27.0

5 rows × 22 columns


In [4]:
# the names of all the columns in the dataset
data.columns


Out[4]:
Index(['Atomic Number', 'Symbol', 'Name', 'Atomic Mass (au or g/mol)',
       'CPK Color (RRGGBB Hex Format)', 'Electronic Configuration',
       'Electronegativity (Pauling)', 'Atomic Radius (pm)', 'Ion Radius (pm)',
       'Van der Waals Radius (pm)', 'IE-1 (kJ/mol)', 'EA (kJ/mol)',
       'Oxidation States', 'Standard State', 'Bonding Type',
       'Melting Point (K)', 'Boiling Point (K)', 'Density (g/mL)',
       'Metal or Nonmetal', 'Year Discovered', 'Mass', 'Radius of Ion'],
      dtype='object')

Looking at some relationships


In [5]:
ax = data.plot('Atomic Number', 'Atomic Radius (pm)', title="Atomic Radius vs. Atomic Number", legend=False)
ax.set(xlabel="x label", ylabel="y label")


Out[5]:
[<matplotlib.text.Text at 0x11247ccc0>, <matplotlib.text.Text at 0x1124625f8>]

In [6]:
data.plot('Atomic Number', 'Mass')


Out[6]:
<matplotlib.axes._subplots.AxesSubplot at 0x1124d4080>

In [7]:
data[['Name', 'Year Discovered']].sort_values(by='Year Discovered')


Out[7]:
Name Year Discovered
14 Phosphorus 1669
8 Fluorine 1670
29 Zinc 1746
27 Nickel 1751
0 Hydrogen 1766
6 Nitrogen 1772
7 Oxygen 1774
24 Manganese 1774
16 Chlorine 1774
41 Molybdenum 1778
51 Tellurium 1782
73 Tungsten 1783
91 Uranium 1789
39 Zirconium 1789
37 Strontium 1790
21 Titanium 1791
38 Yttrium 1794
3 Beryllium 1798
40 Niobium 1801
72 Tantalum 1802
75 Osmium 1803
44 Rhodium 1803
57 Cerium 1803
45 Palladium 1803
22 Vanadium 1803
76 Iridium 1803
4 Boron 1807
18 Potassium 1807
10 Sodium 1807
11 Magnesium 1808
... ... ...
105 Seaborgium 1974
106 Bohrium 1976
108 Meitnerium 1982
107 Hassium 1984
109 Darmstadtium 1994
110 Roentgenium 1994
111 Copernicium 1996
113 Ununquadium 1998
115 Ununhexium 2000
117 Ununoctium 2002
114 Ununpentium 2003
112 Ununtrium 2003
116 Ununseptium 2010
82 Bismuth Ancient
49 Tin Ancient
46 Silver Ancient
32 Arsenic Ancient
28 Copper Ancient
26 Cobalt Ancient
25 Iron Ancient
23 Chromium Ancient
19 Calcium Ancient
15 Sulfur Ancient
77 Platinum Ancient
78 Gold Ancient
79 Mercury Ancient
12 Aluminum or Aluminium Ancient
81 Lead Ancient
5 Carbon Ancient
50 Antimony Ancient

118 rows × 2 columns


In [ ]: