Last active
April 22, 2020 09:51
-
-
Save ddofer/59d0f583823096b878b01d9c05822ff2 to your computer and use it in GitHub Desktop.
Get list of chemical elements from Wikipedia + Pandas
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
# read wikipedia html table with info on all elemetns, including symbols, names, properties: | |
df_base = pd.read_html("https://en.wikipedia.org/wiki/List_of_chemical_elements")[0] | |
element_full_names = df_base["List of chemical elements"]["Element"][:-1] # last row is comments | |
element_full_names =list(element_full_names.apply(lambda x: x[0],axis=1).values) # get individual names out of wrapped list format | |
# element_full_names.to_csv("names_of_elements.csv",index=False) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment