Skip to content

Instantly share code, notes, and snippets.

@kokes
Created March 10, 2016 13:35
Show Gist options
  • Save kokes/b51cf3cf5172f5c6b23b to your computer and use it in GitHub Desktop.
Save kokes/b51cf3cf5172f5c6b23b to your computer and use it in GitHub Desktop.
Trying to replicate pandas issue #2728
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"0.17.1\n"
]
}
],
"source": [
"import pandas\n",
"import threading\n",
"print(pandas.__version__)\n",
"\n",
"df = pandas.DataFrame()\n",
"\n",
"def mutateDf(df):\n",
" while True:\n",
" df[0] = pandas.Series([1,2,3])\n",
" del df[0]\n",
"\n",
"def readDf(df):\n",
" while True:\n",
" dfCopy = df.copy()\n",
" if 0 in dfCopy and 1 in dfCopy[0]:\n",
" a = dfCopy[0][1]\n",
"\n",
"t1 = threading.Thread(target=mutateDf, args=(df,))\n",
"t2 = threading.Thread(target=readDf, args=(df,))\n",
"\n",
"t1.start()\n",
"t2.start()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
}
],
"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.5.1"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment