diff --git a/notebooks/10-Read HDF5 Files with Pandas.ipynb b/notebooks/10-Read HDF5 Files with Pandas.ipynb index a19206f..3cb0f28 100644 --- a/notebooks/10-Read HDF5 Files with Pandas.ipynb +++ b/notebooks/10-Read HDF5 Files with Pandas.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 41, + "execution_count": 1, "metadata": { "collapsed": true }, @@ -13,19 +13,35 @@ }, { "cell_type": "code", - "execution_count": 42, + "execution_count": 12, "metadata": { "collapsed": false }, - "outputs": [], + "outputs": [ + { + "ename": "ValueError", + "evalue": "The file 'hdf5_pandas.h5' is already opened. Please close it before reopening in write mode.", + "output_type": "error", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mValueError\u001b[0m Traceback (most recent call last)", + "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[0;31m# open hdf5 file for reading\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 2\u001b[0;31m \u001b[0mhdf\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mpd\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mHDFStore\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'hdf5_pandas.h5'\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0mmode\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m'w'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[0;32m/Users/Ajay/anaconda/lib/python3.6/site-packages/pandas/io/pytables.py\u001b[0m in \u001b[0;36m__init__\u001b[0;34m(self, path, mode, complevel, complib, fletcher32, **kwargs)\u001b[0m\n\u001b[1;32m 446\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_fletcher32\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mfletcher32\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 447\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_filters\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 448\u001b[0;31m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mopen\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mmode\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mmode\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 449\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 450\u001b[0m \u001b[0;34m@\u001b[0m\u001b[0mproperty\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/Users/Ajay/anaconda/lib/python3.6/site-packages/pandas/io/pytables.py\u001b[0m in \u001b[0;36mopen\u001b[0;34m(self, mode, **kwargs)\u001b[0m\n\u001b[1;32m 610\u001b[0m hdf_version=tables.get_hdf5_version()))\n\u001b[1;32m 611\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 612\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0me\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 613\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 614\u001b[0m \u001b[0;32mexcept\u001b[0m \u001b[0;34m(\u001b[0m\u001b[0mException\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0me\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/Users/Ajay/anaconda/lib/python3.6/site-packages/pandas/io/pytables.py\u001b[0m in \u001b[0;36mopen\u001b[0;34m(self, mode, **kwargs)\u001b[0m\n\u001b[1;32m 585\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 586\u001b[0m \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 587\u001b[0;31m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_handle\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mtables\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mopen_file\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_path\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_mode\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 588\u001b[0m \u001b[0;32mexcept\u001b[0m \u001b[0;34m(\u001b[0m\u001b[0mIOError\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0me\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0;31m# pragma: no cover\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 589\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0;34m'can not be written'\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mstr\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0me\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/Users/Ajay/anaconda/lib/python3.6/site-packages/tables/file.py\u001b[0m in \u001b[0;36mopen_file\u001b[0;34m(filename, mode, title, root_uep, filters, **kwargs)\u001b[0m\n\u001b[1;32m 315\u001b[0m raise ValueError(\n\u001b[1;32m 316\u001b[0m \u001b[0;34m\"The file '%s' is already opened. Please \"\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 317\u001b[0;31m \"close it before reopening in write mode.\" % filename)\n\u001b[0m\u001b[1;32m 318\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 319\u001b[0m \u001b[0;31m# Finally, create the File instance, and return it\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;31mValueError\u001b[0m: The file 'hdf5_pandas.h5' is already opened. Please close it before reopening in write mode." + ] + } + ], "source": [ "# open hdf5 file for reading\n", - "hdf = pd.HDFStore('/home/noureddin/Desktop/hdf5_pandas.h5',mode='r')" + "hdf = pd.HDFStore('hdf5_pandas.h5',mode='w')" ] }, { "cell_type": "code", - "execution_count": 45, + "execution_count": 5, "metadata": { "collapsed": false }, @@ -33,10 +49,10 @@ { "data": { "text/plain": [ - "['/DF1', '/DF2Key']" + "[]" ] }, - "execution_count": 45, + "execution_count": 5, "metadata": {}, "output_type": "execute_result" } @@ -47,31 +63,45 @@ }, { "cell_type": "code", - "execution_count": 46, + "execution_count": 6, "metadata": { "collapsed": false }, - "outputs": [], + "outputs": [ + { + "ename": "KeyError", + "evalue": "'No object named /DF1 in the file'", + "output_type": "error", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mKeyError\u001b[0m Traceback (most recent call last)", + "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mdf1\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mhdf\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mget\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'/DF1'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[0;32m/Users/Ajay/anaconda/lib/python3.6/site-packages/pandas/io/pytables.py\u001b[0m in \u001b[0;36mget\u001b[0;34m(self, key)\u001b[0m\n\u001b[1;32m 675\u001b[0m \u001b[0mgroup\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mget_node\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mkey\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 676\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mgroup\u001b[0m \u001b[0;32mis\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 677\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0mKeyError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'No object named %s in the file'\u001b[0m \u001b[0;34m%\u001b[0m \u001b[0mkey\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 678\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_read_group\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mgroup\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 679\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;31mKeyError\u001b[0m: 'No object named /DF1 in the file'" + ] + } + ], "source": [ "df1 = hdf.get('/DF1')" ] }, { "cell_type": "code", - "execution_count": 47, + "execution_count": 7, "metadata": { "collapsed": false }, "outputs": [ { - "data": { - "text/plain": [ - "pandas.core.frame.DataFrame" - ] - }, - "execution_count": 47, - "metadata": {}, - "output_type": "execute_result" + "ename": "NameError", + "evalue": "name 'df1' is not defined", + "output_type": "error", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)", + "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mtype\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mdf1\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[0;31mNameError\u001b[0m: name 'df1' is not defined" + ] } ], "source": [ @@ -80,182 +110,21 @@ }, { "cell_type": "code", - "execution_count": 49, + "execution_count": 8, "metadata": { "collapsed": false }, "outputs": [ { - "data": { - "text/html": [ - "
\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "
policyIDstatecodecountyeq_site_limithu_site_limitfl_site_limitfr_site_limittiv_2011tiv_2012eq_site_deductiblehu_site_deductiblefl_site_deductiblefr_site_deductiblepoint_latitudepoint_longitudelineconstructionpoint_granularity
0119736FLCLAY COUNTY498960.0498960.00498960.0498960.0498960.00792148.900.09979.20.0030.102261-81.711777ResidentialMasonry1
1448094FLCLAY COUNTY1322376.31322376.301322376.31322376.31322376.301438163.570.00.00.0030.063936-81.707664ResidentialMasonry3
2206893FLCLAY COUNTY190724.4190724.40190724.4190724.4190724.40192476.780.00.00.0030.089579-81.700455ResidentialWood1
3333743FLCLAY COUNTY0.079520.760.00.079520.7686854.480.00.00.0030.063236-81.707703ResidentialWood3
4172534FLCLAY COUNTY0.0254281.500.0254281.5254281.50246144.490.00.00.0030.060614-81.702675ResidentialWood1
\n", - "
" - ], - "text/plain": [ - " policyID statecode county eq_site_limit hu_site_limit \\\n", - "0 119736 FL CLAY COUNTY 498960.0 498960.00 \n", - "1 448094 FL CLAY COUNTY 1322376.3 1322376.30 \n", - "2 206893 FL CLAY COUNTY 190724.4 190724.40 \n", - "3 333743 FL CLAY COUNTY 0.0 79520.76 \n", - "4 172534 FL CLAY COUNTY 0.0 254281.50 \n", - "\n", - " fl_site_limit fr_site_limit tiv_2011 tiv_2012 eq_site_deductible \\\n", - "0 498960.0 498960.0 498960.00 792148.90 0.0 \n", - "1 1322376.3 1322376.3 1322376.30 1438163.57 0.0 \n", - "2 190724.4 190724.4 190724.40 192476.78 0.0 \n", - "3 0.0 0.0 79520.76 86854.48 0.0 \n", - "4 0.0 254281.5 254281.50 246144.49 0.0 \n", - "\n", - " hu_site_deductible fl_site_deductible fr_site_deductible point_latitude \\\n", - "0 9979.2 0.0 0 30.102261 \n", - "1 0.0 0.0 0 30.063936 \n", - "2 0.0 0.0 0 30.089579 \n", - "3 0.0 0.0 0 30.063236 \n", - "4 0.0 0.0 0 30.060614 \n", - "\n", - " point_longitude line construction point_granularity \n", - "0 -81.711777 Residential Masonry 1 \n", - "1 -81.707664 Residential Masonry 3 \n", - "2 -81.700455 Residential Wood 1 \n", - "3 -81.707703 Residential Wood 3 \n", - "4 -81.702675 Residential Wood 1 " - ] - }, - "execution_count": 49, - "metadata": {}, - "output_type": "execute_result" + "ename": "NameError", + "evalue": "name 'df1' is not defined", + "output_type": "error", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)", + "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mdf1\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mhead\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[0;31mNameError\u001b[0m: name 'df1' is not defined" + ] } ], "source": [ @@ -300,7 +169,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.5.2" + "version": "3.6.0" } }, "nbformat": 4, diff --git a/notebooks/3-Creating-and-Saving Data in HDF5 Files.ipynb b/notebooks/3-Creating-and-Saving Data in HDF5 Files.ipynb index 72d734a..4e0e107 100644 --- a/notebooks/3-Creating-and-Saving Data in HDF5 Files.ipynb +++ b/notebooks/3-Creating-and-Saving Data in HDF5 Files.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 28, + "execution_count": 1, "metadata": { "collapsed": true }, @@ -14,7 +14,7 @@ }, { "cell_type": "code", - "execution_count": 29, + "execution_count": 2, "metadata": { "collapsed": false }, @@ -26,16 +26,25 @@ }, { "cell_type": "code", - "execution_count": 30, + "execution_count": 7, "metadata": { "collapsed": false }, "outputs": [], "source": [ - "with h5py.File('/home/noureddin/Desktop/hdf5_data.h5', 'w') as hdf:\n", + "with h5py.File('hdf5_data.h5', 'w') as hdf:\n", " hdf.create_dataset('dataset1', data=matrix1)\n", " hdf.create_dataset('dataset2', data=matrix2)" ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [] } ], "metadata": { @@ -55,7 +64,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.5.2" + "version": "3.6.0" } }, "nbformat": 4, diff --git a/notebooks/4-Reading Data from HDF5 Files.ipynb b/notebooks/4-Reading Data from HDF5 Files.ipynb index a4b4d79..bde07fd 100644 --- a/notebooks/4-Reading Data from HDF5 Files.ipynb +++ b/notebooks/4-Reading Data from HDF5 Files.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 40, + "execution_count": 2, "metadata": { "collapsed": true }, @@ -14,7 +14,7 @@ }, { "cell_type": "code", - "execution_count": 46, + "execution_count": 3, "metadata": { "collapsed": false }, @@ -31,7 +31,7 @@ } ], "source": [ - "with h5py.File('/home/noureddin/Desktop/hdf5_data.h5','r') as hdf:\n", + "with h5py.File('hdf5_data.h5','r') as hdf:\n", " ls = list(hdf.keys())\n", " print('List of datasets in this file: \\n', ls)\n", " data = hdf.get('dataset2')\n", @@ -41,7 +41,7 @@ }, { "cell_type": "code", - "execution_count": 48, + "execution_count": 4, "metadata": { "collapsed": false }, @@ -49,22 +49,22 @@ { "data": { "text/plain": [ - "array([[ 0.86222109, 0.81552981, 0.72947893, ..., 0.8151176 ,\n", - " 0.04256893, 0.20956778],\n", - " [ 0.00223081, 0.33763078, 0.16629403, ..., 0.69963576,\n", - " 0.69310324, 0.77839365],\n", - " [ 0.50803133, 0.88046107, 0.49747202, ..., 0.3320066 ,\n", - " 0.75703668, 0.76684165],\n", + "array([[ 0.66956872, 0.28030814, 0.4792187 , ..., 0.30348151,\n", + " 0.24023435, 0.68310023],\n", + " [ 0.90639203, 0.29122778, 0.98622719, ..., 0.42119197,\n", + " 0.9156541 , 0.39235254],\n", + " [ 0.11785202, 0.47731064, 0.07724071, ..., 0.42268917,\n", + " 0.60948362, 0.7063518 ],\n", " ..., \n", - " [ 0.96940166, 0.28428291, 0.67076274, ..., 0.79801501,\n", - " 0.20872818, 0.28581377],\n", - " [ 0.1356297 , 0.4816769 , 0.08350457, ..., 0.26126381,\n", - " 0.83913621, 0.94482347],\n", - " [ 0.2145087 , 0.21925072, 0.88852823, ..., 0.13799023,\n", - " 0.35711444, 0.97585676]])" + " [ 0.92022095, 0.75778266, 0.01065805, ..., 0.81640267,\n", + " 0.39107846, 0.4930664 ],\n", + " [ 0.11697892, 0.22992495, 0.93729896, ..., 0.51983461,\n", + " 0.52039854, 0.20982922],\n", + " [ 0.15066775, 0.93379293, 0.0358572 , ..., 0.49265581,\n", + " 0.6233502 , 0.40890147]])" ] }, - "execution_count": 48, + "execution_count": 4, "metadata": {}, "output_type": "execute_result" } @@ -75,20 +75,20 @@ }, { "cell_type": "code", - "execution_count": 49, + "execution_count": 6, "metadata": { - "collapsed": true + "collapsed": false }, "outputs": [], "source": [ - "f = h5py.File('/home/noureddin/Desktop/hdf5_data.h5', 'r')\n", + "f = h5py.File('hdf5_data.h5', 'r')\n", "ls = list(f.keys())\n", "f.close()" ] }, { "cell_type": "code", - "execution_count": 50, + "execution_count": 7, "metadata": { "collapsed": false }, @@ -99,7 +99,7 @@ "['dataset1', 'dataset2']" ] }, - "execution_count": 50, + "execution_count": 7, "metadata": {}, "output_type": "execute_result" } @@ -153,7 +153,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.5.2" + "version": "3.6.0" } }, "nbformat": 4, diff --git a/notebooks/5-Creating Groups in HDF5 Files.ipynb b/notebooks/5-Creating Groups in HDF5 Files.ipynb index 2733564..3a77f2d 100644 --- a/notebooks/5-Creating Groups in HDF5 Files.ipynb +++ b/notebooks/5-Creating Groups in HDF5 Files.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 12, + "execution_count": 1, "metadata": { "collapsed": true }, @@ -14,7 +14,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 2, "metadata": { "collapsed": true }, @@ -28,13 +28,13 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 3, "metadata": { "collapsed": true }, "outputs": [], "source": [ - "with h5py.File('/home/noureddin/Desktop/hdf5_groups.h5', 'w') as hdf:\n", + "with h5py.File('hdf5_groups.h5', 'w') as hdf:\n", " G1 = hdf.create_group('Group1')\n", " G1.create_dataset('dataset1', data = matrix1)\n", " G1.create_dataset('dataset4', data = matrix4)\n", @@ -82,7 +82,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.5.2" + "version": "3.6.0" } }, "nbformat": 4, diff --git a/notebooks/6-Reading Groups in HDF5 Files.ipynb b/notebooks/6-Reading Groups in HDF5 Files.ipynb index d7b0dfc..feaecc2 100644 --- a/notebooks/6-Reading Groups in HDF5 Files.ipynb +++ b/notebooks/6-Reading Groups in HDF5 Files.ipynb @@ -80,7 +80,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.5.2" + "version": "3.6.0" } }, "nbformat": 4, diff --git a/notebooks/7-HDF5 Compress Data.ipynb b/notebooks/7-HDF5 Compress Data.ipynb index e5006c8..90cc4d6 100644 --- a/notebooks/7-HDF5 Compress Data.ipynb +++ b/notebooks/7-HDF5 Compress Data.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 10, + "execution_count": 1, "metadata": { "collapsed": true }, @@ -14,7 +14,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 3, "metadata": { "collapsed": true }, @@ -28,13 +28,13 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 4, "metadata": { - "collapsed": true + "collapsed": false }, "outputs": [], "source": [ - "with h5py.File('/home/noureddin/Desktop/hdf5_groups_compressed.h5', 'w') as hdf:\n", + "with h5py.File('hdf5_groups_compressed.h5', 'w') as hdf:\n", " G1 = hdf.create_group('Group1')\n", " G1.create_dataset('dataset1', data = matrix1, compression=\"gzip\", compression_opts=9)\n", " G1.create_dataset('dataset4', data = matrix4, compression=\"gzip\", compression_opts=9)\n", @@ -73,7 +73,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.5.2" + "version": "3.6.0" } }, "nbformat": 4, diff --git a/notebooks/8-HDF5 Attributes.ipynb b/notebooks/8-HDF5 Attributes.ipynb index 43564d0..6080613 100644 --- a/notebooks/8-HDF5 Attributes.ipynb +++ b/notebooks/8-HDF5 Attributes.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 33, + "execution_count": 1, "metadata": { "collapsed": true }, @@ -14,7 +14,7 @@ }, { "cell_type": "code", - "execution_count": 34, + "execution_count": 2, "metadata": { "collapsed": true }, @@ -26,7 +26,7 @@ }, { "cell_type": "code", - "execution_count": 35, + "execution_count": 3, "metadata": { "collapsed": false, "scrolled": true @@ -34,7 +34,7 @@ "outputs": [], "source": [ "# Create the HDF5 file\n", - "hdf = h5py.File('/home/noureddin/Desktop/test.h5', 'w')\n", + "hdf = h5py.File('test.h5', 'w')\n", "\n", "# Create the datasets\n", "dataset1 = hdf.create_dataset('dataset1', data=matrix1)\n", @@ -49,7 +49,7 @@ }, { "cell_type": "code", - "execution_count": 36, + "execution_count": 4, "metadata": { "collapsed": false }, @@ -70,7 +70,7 @@ ], "source": [ "# Read the HDF5 file\n", - "hdf = h5py.File('/home/noureddin/Desktop/test.h5', 'r')\n", + "hdf = h5py.File('test.h5', 'r')\n", "ls = list(hdf.keys())\n", "print('List of datasets in this file: \\n', ls)\n", "data = hdf.get('dataset1')\n", @@ -122,7 +122,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.5.2" + "version": "3.6.0" } }, "nbformat": 4, diff --git a/notebooks/9-Create HDF5 Files with Pandas.ipynb b/notebooks/9-Create HDF5 Files with Pandas.ipynb index 01fc492..5bb1be9 100644 --- a/notebooks/9-Create HDF5 Files with Pandas.ipynb +++ b/notebooks/9-Create HDF5 Files with Pandas.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 68, + "execution_count": 2, "metadata": { "collapsed": true }, @@ -13,14 +13,14 @@ }, { "cell_type": "code", - "execution_count": 69, + "execution_count": 3, "metadata": { - "collapsed": true + "collapsed": false }, "outputs": [], "source": [ "# creates (or opens in append mode) an hdf5 file\n", - "hdf = pd.HDFStore('/home/noureddin/Desktop/hdf5_pandas.h5')" + "hdf = pd.HDFStore('hdf5_pandas.h5')" ] }, { @@ -37,7 +37,7 @@ }, { "cell_type": "code", - "execution_count": 71, + "execution_count": 4, "metadata": { "collapsed": false }, @@ -55,7 +55,7 @@ }, { "cell_type": "code", - "execution_count": 72, + "execution_count": 5, "metadata": { "collapsed": false }, @@ -155,7 +155,7 @@ "8 Sydney 1st 61 72" ] }, - "execution_count": 72, + "execution_count": 5, "metadata": {}, "output_type": "execute_result" } @@ -222,7 +222,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.5.2" + "version": "3.6.0" } }, "nbformat": 4, diff --git a/notebooks/hdf5_data.h5 b/notebooks/hdf5_data.h5 new file mode 100644 index 0000000..bae1ac5 Binary files /dev/null and b/notebooks/hdf5_data.h5 differ diff --git a/notebooks/hdf5_groups.h5 b/notebooks/hdf5_groups.h5 new file mode 100644 index 0000000..319920f Binary files /dev/null and b/notebooks/hdf5_groups.h5 differ diff --git a/notebooks/hdf5_groups_compressed.h5 b/notebooks/hdf5_groups_compressed.h5 new file mode 100644 index 0000000..d5cd2c8 Binary files /dev/null and b/notebooks/hdf5_groups_compressed.h5 differ diff --git a/notebooks/hdf5_pandas.h5 b/notebooks/hdf5_pandas.h5 new file mode 100644 index 0000000..e69de29 diff --git a/notebooks/test.h5 b/notebooks/test.h5 new file mode 100644 index 0000000..f61b82d Binary files /dev/null and b/notebooks/test.h5 differ