Skip to content

Instantly share code, notes, and snippets.

@paulochf
Created February 1, 2018 20:22
Show Gist options
  • Save paulochf/4ffeae6221a9d96c42611cc2a0adae88 to your computer and use it in GitHub Desktop.
Save paulochf/4ffeae6221a9d96c42611cc2a0adae88 to your computer and use it in GitHub Desktop.
Load data matrix using Numpy
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import numpy as np"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([[ 1.1444092e-05, -6.1035156e-05, 8.0108643e-05, ...,\n",
" -7.8201294e-05, 1.9073486e-05, 1.1444092e-05],\n",
" [ 1.1444092e-05, -6.1035156e-05, 8.0108643e-05, ...,\n",
" -7.8201294e-05, 1.9073486e-05, 1.1444092e-05],\n",
" [ 1.1444092e-05, -6.1035156e-05, 8.0108643e-05, ...,\n",
" -7.8201294e-05, 1.9073486e-05, 1.1444092e-05],\n",
" ...,\n",
" [ 2.4229137e+01, 2.3110016e+01, 2.1340733e+01, ...,\n",
" -9.5795441e-01, -7.3286438e-01, -4.2309189e-01],\n",
" [ 2.4168774e+01, 2.2969147e+01, 2.1114292e+01, ...,\n",
" 1.0905056e+00, 1.1677818e+00, 1.3992653e+00],\n",
" [ 2.9535503e+01, 2.7498508e+01, 2.4384159e+01, ...,\n",
" 4.9166622e+00, 3.2706280e+00, 1.2978973e+00]], dtype=float32)"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"np.load(\"teste.npy\")"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[ 1.1444092e-05 -6.1035156e-05 8.0108643e-05 -6.1035156e-05\n",
" 2.2888184e-05 -2.6702881e-05 -5.3405762e-05 -4.5776367e-05\n",
" -2.2888184e-05 -2.6702881e-05 -3.0517578e-05 -3.8146973e-05\n",
" 9.9182129e-05 4.1961670e-05 0.0000000e+00 -5.7220459e-05\n",
" -7.8201294e-05 1.9073486e-05 1.1444092e-05]\n"
]
}
],
"source": [
"with open(\"teste.npy\", \"rb\") as f:\n",
" data = np.load(f)\n",
" print(data[0])"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"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.6.1"
},
"toc": {
"nav_menu": {},
"number_sections": true,
"sideBar": true,
"skip_h1_title": false,
"toc_cell": false,
"toc_position": {},
"toc_section_display": "block",
"toc_window_display": false
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment