Created
June 28, 2020 23:09
-
-
Save Raahul-Singh/6e9bff5a4233e1722cbcab91632616c9 to your computer and use it in GitHub Desktop.
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
{ | |
"cells": [ | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"# Data Preparation\n", | |
"Making a new dataframe that holds information for any flare being produced and the associated AR complexity." | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 10, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"# These are the flare classes and the NOAA numbers of the ARs\n", | |
"observed_columns = ['c1flr24hr', 'm1flr12hr', 'm5flr12hr', 'noaa']\n", | |
"flares_complexities = copy.deepcopy(properties[observed_columns])\n", | |
"flares_complexities['complexity'] = rankings.score" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 11, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"def combine_flaring_columns(ar):\n", | |
" ar['flares'] = ar.m5flr12hr | ar.m1flr12hr | ar.c1flr24hr\n", | |
" ar.drop(['m5flr12hr', 'm1flr12hr', 'c1flr24hr'], axis=1, inplace=True)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 12, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/html": [ | |
"<div>\n", | |
"<style scoped>\n", | |
" .dataframe tbody tr th:only-of-type {\n", | |
" vertical-align: middle;\n", | |
" }\n", | |
"\n", | |
" .dataframe tbody tr th {\n", | |
" vertical-align: top;\n", | |
" }\n", | |
"\n", | |
" .dataframe thead th {\n", | |
" text-align: right;\n", | |
" }\n", | |
"</style>\n", | |
"<table border=\"1\" class=\"dataframe\">\n", | |
" <thead>\n", | |
" <tr style=\"text-align: right;\">\n", | |
" <th></th>\n", | |
" <th>noaa</th>\n", | |
" <th>complexity</th>\n", | |
" <th>flares</th>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>#id</th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" </tr>\n", | |
" </thead>\n", | |
" <tbody>\n", | |
" <tr>\n", | |
" <th>1</th>\n", | |
" <td>8809</td>\n", | |
" <td>1126.778324</td>\n", | |
" <td>0</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>2</th>\n", | |
" <td>8810</td>\n", | |
" <td>1312.434736</td>\n", | |
" <td>0</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>3</th>\n", | |
" <td>8812</td>\n", | |
" <td>962.280235</td>\n", | |
" <td>0</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>4</th>\n", | |
" <td>8813</td>\n", | |
" <td>1199.623395</td>\n", | |
" <td>0</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>5</th>\n", | |
" <td>8814</td>\n", | |
" <td>1270.270911</td>\n", | |
" <td>0</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>6</th>\n", | |
" <td>8810</td>\n", | |
" <td>1293.377418</td>\n", | |
" <td>0</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>7</th>\n", | |
" <td>8813</td>\n", | |
" <td>1236.575624</td>\n", | |
" <td>1</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>8</th>\n", | |
" <td>8814</td>\n", | |
" <td>1209.593634</td>\n", | |
" <td>0</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>9</th>\n", | |
" <td>8815</td>\n", | |
" <td>1299.871029</td>\n", | |
" <td>1</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>10</th>\n", | |
" <td>8810</td>\n", | |
" <td>1306.593595</td>\n", | |
" <td>1</td>\n", | |
" </tr>\n", | |
" </tbody>\n", | |
"</table>\n", | |
"</div>" | |
], | |
"text/plain": [ | |
" noaa complexity flares\n", | |
"#id \n", | |
"1 8809 1126.778324 0\n", | |
"2 8810 1312.434736 0\n", | |
"3 8812 962.280235 0\n", | |
"4 8813 1199.623395 0\n", | |
"5 8814 1270.270911 0\n", | |
"6 8810 1293.377418 0\n", | |
"7 8813 1236.575624 1\n", | |
"8 8814 1209.593634 0\n", | |
"9 8815 1299.871029 1\n", | |
"10 8810 1306.593595 1" | |
] | |
}, | |
"execution_count": 12, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"combine_flaring_columns(flares_complexities)\n", | |
"\n", | |
"flares_complexities.head(10)" | |
] | |
} | |
], | |
"metadata": { | |
"kernelspec": { | |
"display_name": "Python 3", | |
"language": "python", | |
"name": "python3" | |
}, | |
"language_info": { | |
"codemirror_mode": { | |
"name": "ipython", | |
"version": 3 | |
}, | |
"file_extension": ".py", | |
"mimetype": "text/x-python", | |
"name": "python", | |
"nbconvert_exporter": "python", | |
"pygments_lexer": "ipython3", | |
"version": "3.6.10" | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 4 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment