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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"library(feather)"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
" mpg cyl disp hp \n",
" Min. :10.40 Min. :4.000 Min. : 71.1 Min. : 52.0 \n",
" 1st Qu.:15.43 1st Qu.:4.000 1st Qu.:120.8 1st Qu.: 96.5 \n",
" Median :19.20 Median :6.000 Median :196.3 Median :123.0 \n",
" Mean :20.09 Mean :6.188 Mean :230.7 Mean :146.7 \n",
" 3rd Qu.:22.80 3rd Qu.:8.000 3rd Qu.:326.0 3rd Qu.:180.0 \n",
" Max. :33.90 Max. :8.000 Max. :472.0 Max. :335.0 \n",
" drat wt qsec vs \n",
" Min. :2.760 Min. :1.513 Min. :14.50 Min. :0.0000 \n",
" 1st Qu.:3.080 1st Qu.:2.581 1st Qu.:16.89 1st Qu.:0.0000 \n",
" Median :3.695 Median :3.325 Median :17.71 Median :0.0000 \n",
" Mean :3.597 Mean :3.217 Mean :17.85 Mean :0.4375 \n",
" 3rd Qu.:3.920 3rd Qu.:3.610 3rd Qu.:18.90 3rd Qu.:1.0000 \n",
" Max. :4.930 Max. :5.424 Max. :22.90 Max. :1.0000 \n",
" am gear carb \n",
" Min. :0.0000 Min. :3.000 Min. :1.000 \n",
" 1st Qu.:0.0000 1st Qu.:3.000 1st Qu.:2.000 \n",
" Median :0.0000 Median :4.000 Median :2.000 \n",
" Mean :0.4062 Mean :3.688 Mean :2.812 \n",
" 3rd Qu.:1.0000 3rd Qu.:4.000 3rd Qu.:4.000 \n",
" Max. :1.0000 Max. :5.000 Max. :8.000 "
]
},
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"summary(mtcars)"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"write_feather(mtcars, \"/tmp/mtcars.feather\")"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
" mpg cyl disp hp \n",
" Min. :10.40 Min. :4.000 Min. : 71.1 Min. : 52.0 \n",
" 1st Qu.:15.43 1st Qu.:4.000 1st Qu.:120.8 1st Qu.: 96.5 \n",
" Median :19.20 Median :6.000 Median :196.3 Median :123.0 \n",
" Mean :20.09 Mean :6.188 Mean :230.7 Mean :146.7 \n",
" 3rd Qu.:22.80 3rd Qu.:8.000 3rd Qu.:326.0 3rd Qu.:180.0 \n",
" Max. :33.90 Max. :8.000 Max. :472.0 Max. :335.0 \n",
" drat wt qsec vs \n",
" Min. :2.760 Min. :1.513 Min. :14.50 Min. :0.0000 \n",
" 1st Qu.:3.080 1st Qu.:2.581 1st Qu.:16.89 1st Qu.:0.0000 \n",
" Median :3.695 Median :3.325 Median :17.71 Median :0.0000 \n",
" Mean :3.597 Mean :3.217 Mean :17.85 Mean :0.4375 \n",
" 3rd Qu.:3.920 3rd Qu.:3.610 3rd Qu.:18.90 3rd Qu.:1.0000 \n",
" Max. :4.930 Max. :5.424 Max. :22.90 Max. :1.0000 \n",
" am gear carb \n",
" Min. :0.0000 Min. :3.000 Min. :1.000 \n",
" 1st Qu.:0.0000 1st Qu.:3.000 1st Qu.:2.000 \n",
" Median :0.0000 Median :4.000 Median :2.000 \n",
" Mean :0.4062 Mean :3.688 Mean :2.812 \n",
" 3rd Qu.:1.0000 3rd Qu.:4.000 3rd Qu.:4.000 \n",
" Max. :1.0000 Max. :5.000 Max. :8.000 "
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"mtcars.feather <- read_feather(\"/tmp/mtcars.feather\")\n",
"summary(mtcars.feather)"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
" am carb cyl disp \n",
" Min. :0.0000 Min. :1.000 Min. :4.000 Min. : 71.1 \n",
" 1st Qu.:0.0000 1st Qu.:2.000 1st Qu.:4.000 1st Qu.:120.8 \n",
" Median :0.0000 Median :2.000 Median :6.000 Median :196.3 \n",
" Mean :0.4062 Mean :2.812 Mean :6.188 Mean :230.7 \n",
" 3rd Qu.:1.0000 3rd Qu.:4.000 3rd Qu.:8.000 3rd Qu.:326.0 \n",
" Max. :1.0000 Max. :8.000 Max. :8.000 Max. :472.0 \n",
" drat gear hp mpg \n",
" Min. :2.760 Min. :3.000 Min. : 52.0 Min. :10.40 \n",
" 1st Qu.:3.080 1st Qu.:3.000 1st Qu.: 96.5 1st Qu.:15.43 \n",
" Median :3.695 Median :4.000 Median :123.0 Median :19.20 \n",
" Mean :3.597 Mean :3.688 Mean :146.7 Mean :20.09 \n",
" 3rd Qu.:3.920 3rd Qu.:4.000 3rd Qu.:180.0 3rd Qu.:22.80 \n",
" Max. :4.930 Max. :5.000 Max. :335.0 Max. :33.90 \n",
" qsec vs wt \n",
" Min. :14.50 Min. :0.0000 Min. :1.513 \n",
" 1st Qu.:16.89 1st Qu.:0.0000 1st Qu.:2.581 \n",
" Median :17.71 Median :0.0000 Median :3.325 \n",
" Mean :17.85 Mean :0.4375 Mean :3.217 \n",
" 3rd Qu.:18.90 3rd Qu.:1.0000 3rd Qu.:3.610 \n",
" Max. :22.90 Max. :1.0000 Max. :5.424 "
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"mtcars.python <- read_feather(\"/tmp/mtcars_from_python.feather\")\n",
"summary(mtcars.python)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "R",
"language": "R",
"name": "ir"
},
"language_info": {
"codemirror_mode": "r",
"file_extension": ".r",
"mimetype": "text/x-r-source",
"name": "R",
"pygments_lexer": "r",
"version": "3.2.4"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment