Advertisement
Guest User

Untitled

a guest
Oct 8th, 2015
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.73 KB | None | 0 0
  1. {
  2. "cells": [
  3. {
  4. "cell_type": "code",
  5. "execution_count": 2,
  6. "metadata": {
  7. "collapsed": true
  8. },
  9. "outputs": [],
  10. "source": [
  11. "import pandas as pd"
  12. ]
  13. },
  14. {
  15. "cell_type": "code",
  16. "execution_count": 3,
  17. "metadata": {
  18. "collapsed": false
  19. },
  20. "outputs": [
  21. {
  22. "data": {
  23. "text/plain": [
  24. "'0.16.2'"
  25. ]
  26. },
  27. "execution_count": 3,
  28. "metadata": {},
  29. "output_type": "execute_result"
  30. }
  31. ],
  32. "source": [
  33. "pd.__version__"
  34. ]
  35. },
  36. {
  37. "cell_type": "code",
  38. "execution_count": 15,
  39. "metadata": {
  40. "collapsed": true
  41. },
  42. "outputs": [],
  43. "source": [
  44. "df = pd.DataFrame(['One', 'Two', 'Three'], index=['one', 'two', 'nan'])"
  45. ]
  46. },
  47. {
  48. "cell_type": "code",
  49. "execution_count": 16,
  50. "metadata": {
  51. "collapsed": false
  52. },
  53. "outputs": [
  54. {
  55. "data": {
  56. "text/html": [
  57. "<div>\n",
  58. "<table border=\"1\" class=\"dataframe\">\n",
  59. " <thead>\n",
  60. " <tr style=\"text-align: right;\">\n",
  61. " <th></th>\n",
  62. " <th>0</th>\n",
  63. " </tr>\n",
  64. " </thead>\n",
  65. " <tbody>\n",
  66. " <tr>\n",
  67. " <th>one</th>\n",
  68. " <td>One</td>\n",
  69. " </tr>\n",
  70. " <tr>\n",
  71. " <th>two</th>\n",
  72. " <td>Two</td>\n",
  73. " </tr>\n",
  74. " <tr>\n",
  75. " <th>nan</th>\n",
  76. " <td>Three</td>\n",
  77. " </tr>\n",
  78. " </tbody>\n",
  79. "</table>\n",
  80. "</div>"
  81. ],
  82. "text/plain": [
  83. " 0\n",
  84. "one One\n",
  85. "two Two\n",
  86. "nan Three"
  87. ]
  88. },
  89. "execution_count": 16,
  90. "metadata": {},
  91. "output_type": "execute_result"
  92. }
  93. ],
  94. "source": [
  95. "df"
  96. ]
  97. },
  98. {
  99. "cell_type": "code",
  100. "execution_count": 17,
  101. "metadata": {
  102. "collapsed": true
  103. },
  104. "outputs": [],
  105. "source": [
  106. "df.to_hdf('test.h5', key='df')"
  107. ]
  108. },
  109. {
  110. "cell_type": "code",
  111. "execution_count": 18,
  112. "metadata": {
  113. "collapsed": true
  114. },
  115. "outputs": [],
  116. "source": [
  117. "df2 = pd.read_hdf('/tmp/test.h5', key='df')"
  118. ]
  119. },
  120. {
  121. "cell_type": "code",
  122. "execution_count": 19,
  123. "metadata": {
  124. "collapsed": false
  125. },
  126. "outputs": [
  127. {
  128. "data": {
  129. "text/html": [
  130. "<div>\n",
  131. "<table border=\"1\" class=\"dataframe\">\n",
  132. " <thead>\n",
  133. " <tr style=\"text-align: right;\">\n",
  134. " <th></th>\n",
  135. " <th>0</th>\n",
  136. " </tr>\n",
  137. " </thead>\n",
  138. " <tbody>\n",
  139. " <tr>\n",
  140. " <th>one</th>\n",
  141. " <td>One</td>\n",
  142. " </tr>\n",
  143. " <tr>\n",
  144. " <th>two</th>\n",
  145. " <td>Two</td>\n",
  146. " </tr>\n",
  147. " <tr>\n",
  148. " <th>NaN</th>\n",
  149. " <td>Three</td>\n",
  150. " </tr>\n",
  151. " </tbody>\n",
  152. "</table>\n",
  153. "</div>"
  154. ],
  155. "text/plain": [
  156. " 0\n",
  157. "one One\n",
  158. "two Two\n",
  159. "NaN Three"
  160. ]
  161. },
  162. "execution_count": 19,
  163. "metadata": {},
  164. "output_type": "execute_result"
  165. }
  166. ],
  167. "source": [
  168. "df2"
  169. ]
  170. },
  171. {
  172. "cell_type": "code",
  173. "execution_count": null,
  174. "metadata": {
  175. "collapsed": true
  176. },
  177. "outputs": [],
  178. "source": []
  179. }
  180. ],
  181. "metadata": {
  182. "kernelspec": {
  183. "display_name": "Python 3",
  184. "language": "python",
  185. "name": "python3"
  186. },
  187. "language_info": {
  188. "codemirror_mode": {
  189. "name": "ipython",
  190. "version": 3
  191. },
  192. "file_extension": ".py",
  193. "mimetype": "text/x-python",
  194. "name": "python",
  195. "nbconvert_exporter": "python",
  196. "pygments_lexer": "ipython3",
  197. "version": "3.4.3"
  198. }
  199. },
  200. "nbformat": 4,
  201. "nbformat_minor": 0
  202. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement