Skip to content

Instantly share code, notes, and snippets.

@armish
Created March 30, 2016 18:02
Show Gist options
  • Select an option

  • Save armish/08754964e286a8c8d2631c08cfb0a5b0 to your computer and use it in GitHub Desktop.

Select an option

Save armish/08754964e286a8c8d2631c08cfb0a5b0 to your computer and use it in GitHub Desktop.
Feather rocks \o/
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": 6,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"import pandas as pd\n",
"import feather\n",
"import numpy as np"
]
},
{
"cell_type": "code",
"execution_count": 7,
"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>am</th>\n",
" <th>carb</th>\n",
" <th>cyl</th>\n",
" <th>disp</th>\n",
" <th>drat</th>\n",
" <th>gear</th>\n",
" <th>hp</th>\n",
" <th>mpg</th>\n",
" <th>qsec</th>\n",
" <th>vs</th>\n",
" <th>wt</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>count</th>\n",
" <td>32.000000</td>\n",
" <td>32.0000</td>\n",
" <td>32.000000</td>\n",
" <td>32.000000</td>\n",
" <td>32.000000</td>\n",
" <td>32.000000</td>\n",
" <td>32.000000</td>\n",
" <td>32.000000</td>\n",
" <td>32.000000</td>\n",
" <td>32.000000</td>\n",
" <td>32.000000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>mean</th>\n",
" <td>0.406250</td>\n",
" <td>2.8125</td>\n",
" <td>6.187500</td>\n",
" <td>230.721875</td>\n",
" <td>3.596563</td>\n",
" <td>3.687500</td>\n",
" <td>146.687500</td>\n",
" <td>20.090625</td>\n",
" <td>17.848750</td>\n",
" <td>0.437500</td>\n",
" <td>3.217250</td>\n",
" </tr>\n",
" <tr>\n",
" <th>std</th>\n",
" <td>0.498991</td>\n",
" <td>1.6152</td>\n",
" <td>1.785922</td>\n",
" <td>123.938694</td>\n",
" <td>0.534679</td>\n",
" <td>0.737804</td>\n",
" <td>68.562868</td>\n",
" <td>6.026948</td>\n",
" <td>1.786943</td>\n",
" <td>0.504016</td>\n",
" <td>0.978457</td>\n",
" </tr>\n",
" <tr>\n",
" <th>min</th>\n",
" <td>0.000000</td>\n",
" <td>1.0000</td>\n",
" <td>4.000000</td>\n",
" <td>71.100000</td>\n",
" <td>2.760000</td>\n",
" <td>3.000000</td>\n",
" <td>52.000000</td>\n",
" <td>10.400000</td>\n",
" <td>14.500000</td>\n",
" <td>0.000000</td>\n",
" <td>1.513000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>25%</th>\n",
" <td>0.000000</td>\n",
" <td>2.0000</td>\n",
" <td>4.000000</td>\n",
" <td>120.825000</td>\n",
" <td>3.080000</td>\n",
" <td>3.000000</td>\n",
" <td>96.500000</td>\n",
" <td>15.425000</td>\n",
" <td>16.892500</td>\n",
" <td>0.000000</td>\n",
" <td>2.581250</td>\n",
" </tr>\n",
" <tr>\n",
" <th>50%</th>\n",
" <td>0.000000</td>\n",
" <td>2.0000</td>\n",
" <td>6.000000</td>\n",
" <td>196.300000</td>\n",
" <td>3.695000</td>\n",
" <td>4.000000</td>\n",
" <td>123.000000</td>\n",
" <td>19.200000</td>\n",
" <td>17.710000</td>\n",
" <td>0.000000</td>\n",
" <td>3.325000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>75%</th>\n",
" <td>1.000000</td>\n",
" <td>4.0000</td>\n",
" <td>8.000000</td>\n",
" <td>326.000000</td>\n",
" <td>3.920000</td>\n",
" <td>4.000000</td>\n",
" <td>180.000000</td>\n",
" <td>22.800000</td>\n",
" <td>18.900000</td>\n",
" <td>1.000000</td>\n",
" <td>3.610000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>max</th>\n",
" <td>1.000000</td>\n",
" <td>8.0000</td>\n",
" <td>8.000000</td>\n",
" <td>472.000000</td>\n",
" <td>4.930000</td>\n",
" <td>5.000000</td>\n",
" <td>335.000000</td>\n",
" <td>33.900000</td>\n",
" <td>22.900000</td>\n",
" <td>1.000000</td>\n",
" <td>5.424000</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" am carb cyl disp drat gear \\\n",
"count 32.000000 32.0000 32.000000 32.000000 32.000000 32.000000 \n",
"mean 0.406250 2.8125 6.187500 230.721875 3.596563 3.687500 \n",
"std 0.498991 1.6152 1.785922 123.938694 0.534679 0.737804 \n",
"min 0.000000 1.0000 4.000000 71.100000 2.760000 3.000000 \n",
"25% 0.000000 2.0000 4.000000 120.825000 3.080000 3.000000 \n",
"50% 0.000000 2.0000 6.000000 196.300000 3.695000 4.000000 \n",
"75% 1.000000 4.0000 8.000000 326.000000 3.920000 4.000000 \n",
"max 1.000000 8.0000 8.000000 472.000000 4.930000 5.000000 \n",
"\n",
" hp mpg qsec vs wt \n",
"count 32.000000 32.000000 32.000000 32.000000 32.000000 \n",
"mean 146.687500 20.090625 17.848750 0.437500 3.217250 \n",
"std 68.562868 6.026948 1.786943 0.504016 0.978457 \n",
"min 52.000000 10.400000 14.500000 0.000000 1.513000 \n",
"25% 96.500000 15.425000 16.892500 0.000000 2.581250 \n",
"50% 123.000000 19.200000 17.710000 0.000000 3.325000 \n",
"75% 180.000000 22.800000 18.900000 1.000000 3.610000 \n",
"max 335.000000 33.900000 22.900000 1.000000 5.424000 "
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"mtcars = feather.read_dataframe(\"/tmp/mtcars.feather\")\n",
"mtcars.describe()"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"feather.write_dataframe(mtcars, \"/tmp/mtcars_from_python.feather\")"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 2",
"language": "python",
"name": "python2"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.11"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment