Skip to content

Instantly share code, notes, and snippets.

View MartyC-137's full-sized avatar
🤠

Martin Palkovic MartyC-137

🤠
View GitHub Profile
@MartyC-137
MartyC-137 / Cu.py
Last active September 2, 2021 10:06
#load data --------------------
df = pd.read_csv('analytes.csv')
df_ml = df[['MASTERID'] + [col for col in df if 'ICP' in col]]
#train-test split -------------------------------------------------------------
X = df_ml.loc[:, ~df_ml.columns.isin(['Cu_ICP_PPM'])].drop('MASTERID', axis = 1)
y = df_ml['Cu_ICP_PPM']
X_train, X_test, y_train, y_test = train_test_split(X, y)
#import modules, data
import pandas as pd
df = pd.read_csv('litho-Table 1.csv', low_memory = False)
df = df[df.columns[df.isnull().mean() < 0.25]]
df = df.drop([col for col in df.columns if 'FA' in col or 'INA' in col or 'AAS' in col],
axis = 1) #drop analytes that aren't ICP-MS analysis
df = df[['MASTERID', 'LAT', 'LONG',
'STRAT'] + [col for col in df.columns if 'ICP' in col]]
#this program will check your data against the Canadian critical minerals list and tell you if your dataset contains any of them
#import modules ---
import pandas as pd
pd.set_option('display.max_rows', None)
pd.set_option('display.max_columns', None)
#load data -------------------------
df = pd.read_csv('litho-Table 1.csv',
low_memory = False)
df_litho = pd.read_csv('geology_at_sample_site-Table 1.csv')
df = df.merge(df_litho, on = 'MASTERID')