Fix hash() bug reported by Thiago

This commit is contained in:
Aurelien Geron
2016-11-03 17:47:08 +01:00
parent 8ec063695d
commit ae81f69729

View File

@@ -446,7 +446,7 @@
"import hashlib\n",
"\n",
"def test_set_check(identifier, test_ratio, hash):\n",
" return hash(identifier).digest()[-1] < 256 * test_ratio\n",
" return hash(str(identifier).encode(\"ascii\")).digest()[-1] < 256 * test_ratio\n",
"\n",
"def split_train_test_by_id(data, test_ratio, id_column, hash=hashlib.md5):\n",
" ids = data[id_column]\n",
@@ -3438,7 +3438,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.5.1"
"version": "3.5.2"
},
"nav_menu": {
"height": "279px",