Skip to content

Instantly share code, notes, and snippets.

@CongenitalOptimist93
Created April 17, 2017 18:59
Show Gist options
  • Save CongenitalOptimist93/cc494189c7737bf2fb7f83fb3c9d8124 to your computer and use it in GitHub Desktop.
Save CongenitalOptimist93/cc494189c7737bf2fb7f83fb3c9d8124 to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"raw_data = {'Planet': ['Mercury', 'Venus', 'Earth', 'Mars'],\n",
" 'Mass_(10^24kg)': [0.330,4.87,5.97,0.642],\n",
" 'Distance_From_Sun(10^6km)':[57.9,108.2,149.6,227.9],\n",
" 'Escape_Velocity_(km/s)':[4.3,10.4,11.2,5.0],\n",
" 'Mean_Temperature(C)':[167,464,15,-65],\n",
" 'Orbital_Period (days)': [88.0,224.7,365.2,687.0]}\n"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"import pandas as pd "
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"inner_planets = pd.DataFrame(raw_data, columns = ['Planet','Mass_(10^24kg)', 'Distance_From_Sun(10^6km)','Escape_Velocity_(km/s)','Mean_Temperature(C)'])\n"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Planet</th>\n",
" <th>Mass_(10^24kg)</th>\n",
" <th>Distance_From_Sun(10^6km)</th>\n",
" <th>Escape_Velocity_(km/s)</th>\n",
" <th>Mean_Temperature(C)</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>Mercury</td>\n",
" <td>0.330</td>\n",
" <td>57.9</td>\n",
" <td>4.3</td>\n",
" <td>167</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>Venus</td>\n",
" <td>4.870</td>\n",
" <td>108.2</td>\n",
" <td>10.4</td>\n",
" <td>464</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>Earth</td>\n",
" <td>5.970</td>\n",
" <td>149.6</td>\n",
" <td>11.2</td>\n",
" <td>15</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>Mars</td>\n",
" <td>0.642</td>\n",
" <td>227.9</td>\n",
" <td>5.0</td>\n",
" <td>-65</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Planet Mass_(10^24kg) Distance_From_Sun(10^6km) Escape_Velocity_(km/s) \\\n",
"0 Mercury 0.330 57.9 4.3 \n",
"1 Venus 4.870 108.2 10.4 \n",
"2 Earth 5.970 149.6 11.2 \n",
"3 Mars 0.642 227.9 5.0 \n",
"\n",
" Mean_Temperature(C) \n",
"0 167 \n",
"1 464 \n",
"2 15 \n",
"3 -65 "
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"inner_planets"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
}
],
"metadata": {
"anaconda-cloud": {},
"kernelspec": {
"display_name": "Python [conda root]",
"language": "python",
"name": "conda-root-py"
},
"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.5.2"
}
},
"nbformat": 4,
"nbformat_minor": 1
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment