Skip to content

Instantly share code, notes, and snippets.

Created December 28, 2012 20:12
Show Gist options
  • Save anonymous/4401461 to your computer and use it in GitHub Desktop.
Save anonymous/4401461 to your computer and use it in GitHub Desktop.
Python Pandas crash example
#!/usr/bin/env python
THREADS = 6
PASSES = 1000
import threading, sys
import pandas as pd
from cStringIO import StringIO
def main():
threads = [ threading.Thread(target=threadfunc) for i in range(THREADS) ]
for th in threads:
th.start()
for th in threads:
th.join()
def threadfunc():
names = ['index', 'open', 'high', 'low', 'close', 'volume', 'adjclose']
ident = threading.current_thread().ident
for i in xrange(PASSES):
print '{}:{}'.format(ident, i)
sys.stdout.flush()
df = pd.read_csv(StringIO(CONTENT), index_col=0, parse_dates=True,
skiprows=1, # skip the header and use our more convenient names below
names=names)
CONTENT = """\
Date,Open,High,Low,Close,Volume,Adj Close
2012-12-27,8.75,8.76,8.53,8.62,16432000,8.62
2012-12-26,8.64,8.80,8.64,8.73,14435200,8.73
2012-12-24,8.53,8.64,8.52,8.62,8064200,8.62
2012-12-21,8.65,8.66,8.51,8.57,19066800,8.57
2012-12-20,8.63,8.70,8.60,8.70,14892000,8.70
2012-12-19,8.84,8.85,8.62,8.64,27418200,8.64
2012-12-18,8.75,8.91,8.75,8.91,18736200,8.91
2012-12-17,8.77,8.79,8.62,8.75,16364800,8.75
2012-12-14,8.60,8.75,8.59,8.74,13279800,8.74
2012-12-13,8.64,8.71,8.56,8.59,12192700,8.59
2012-12-12,8.71,8.72,8.61,8.65,14378400,8.65
2012-12-11,8.58,8.72,8.55,8.68,17204000,8.68
2012-12-10,8.46,8.60,8.46,8.57,11892800,8.57
2012-12-07,8.57,8.59,8.45,8.50,12167400,8.50
2012-12-06,8.56,8.60,8.48,8.57,11909100,8.57
2012-12-05,8.44,8.62,8.43,8.57,17286800,8.57
2012-12-04,8.37,8.49,8.35,8.42,11000600,8.42
2012-12-03,8.45,8.45,8.35,8.41,13646700,8.41
2012-11-30,8.41,8.45,8.32,8.41,12200900,8.41
2012-11-29,8.46,8.50,8.35,8.40,13496600,8.40
2012-11-28,8.21,8.41,8.16,8.40,17479800,8.40
2012-11-27,8.30,8.42,8.28,8.28,10803200,8.28
2012-11-26,8.33,8.35,8.25,8.31,11971600,8.31
2012-11-23,8.33,8.35,8.26,8.35,7821400,8.35
2012-11-21,8.27,8.32,8.22,8.27,8611000,8.27
2012-11-20,8.30,8.31,8.14,8.25,14130400,8.25
2012-11-19,8.27,8.35,8.21,8.34,14606500,8.34
2012-11-16,8.09,8.20,7.98,8.18,22913500,8.18
2012-11-15,8.11,8.19,8.02,8.05,14798900,8.05
2012-11-14,8.33,8.36,8.10,8.13,14175500,8.13
2012-11-13,8.36,8.44,8.30,8.31,11103900,8.31
2012-11-12,8.43,8.48,8.38,8.43,8583500,8.43
2012-11-09,8.34,8.57,8.32,8.43,18237400,8.43
2012-11-08,8.49,8.56,8.30,8.39,18583700,8.39
2012-11-07,8.61,8.63,8.47,8.48,24739200,8.48
2012-11-06,8.67,8.80,8.62,8.74,19837900,8.74
2012-11-05,8.60,8.70,8.59,8.61,16654500,8.61
2012-11-02,8.81,8.82,8.62,8.65,13631900,8.65
2012-11-01,8.62,8.81,8.59,8.75,17904500,8.75
2012-10-31,8.67,8.71,8.56,8.57,16074600,8.57
2012-10-26,8.70,8.79,8.63,8.65,14211900,8.62
2012-10-25,8.76,8.81,8.65,8.73,12167500,8.70
2012-10-24,8.85,8.92,8.68,8.70,20239700,8.67
2012-10-23,8.93,8.94,8.78,8.78,23433900,8.75
2012-10-22,8.98,9.15,8.96,9.10,15913300,9.07
2012-10-19,9.18,9.20,8.65,9.01,15823600,8.98
2012-10-18,9.11,9.27,9.07,9.21,15739400,9.18
2012-10-17,9.02,9.22,8.97,9.18,16391900,9.15
2012-10-16,8.83,8.97,8.81,8.94,16740400,8.91
2012-10-15,8.72,8.81,8.63,8.80,14615600,8.77
2012-10-12,8.78,8.86,8.66,8.69,15395000,8.66
2012-10-11,8.78,8.88,8.71,8.77,15602900,8.74
2012-10-10,9.05,9.06,8.66,8.71,48171800,8.68
2012-10-09,9.19,9.25,9.09,9.13,32181800,9.10
2012-10-08,9.02,9.22,9.00,9.12,14252300,9.09
2012-10-05,9.21,9.34,9.03,9.09,19292900,9.06
2012-10-04,8.84,9.11,8.81,9.07,24420100,9.04
2012-10-03,8.87,8.90,8.72,8.78,14563300,8.75
2012-10-02,8.97,8.99,8.79,8.85,13760600,8.82
2012-10-01,8.94,9.07,8.86,8.91,17007000,8.88
2012-09-28,8.91,8.95,8.84,8.86,15114600,8.83
2012-09-27,8.89,9.02,8.82,8.99,18485600,8.96
2012-09-26,8.79,8.98,8.65,8.89,25640000,8.86
2012-09-25,9.15,9.19,8.81,8.84,23210000,8.81
2012-09-24,9.05,9.13,9.02,9.06,15640900,9.03
2012-09-21,9.34,9.37,9.10,9.13,22879400,9.10
2012-09-20,9.37,9.41,9.18,9.25,20860900,9.22
2012-09-19,9.61,9.65,9.47,9.47,15458600,9.44
2012-09-18,9.43,9.60,9.33,9.49,21122600,9.46
2012-09-17,9.72,9.79,9.56,9.58,18821600,9.55
2012-09-14,9.80,9.93,9.78,9.84,29709800,9.81
2012-09-13,9.32,9.68,9.30,9.63,29682400,9.60
2012-09-12,9.44,9.46,9.19,9.35,18559300,9.32
2012-09-11,9.12,9.40,9.09,9.33,20524900,9.30
2012-09-10,9.08,9.31,9.03,9.05,29599000,9.02
2012-09-07,8.83,9.10,8.83,9.10,26126200,9.07
2012-09-06,8.59,8.80,8.59,8.76,13818700,8.73
2012-09-05,8.43,8.55,8.40,8.52,12027400,8.49
2012-09-04,8.56,8.56,8.41,8.42,11830000,8.39
2012-08-31,8.53,8.60,8.43,8.56,16911500,8.53
2012-08-30,8.47,8.50,8.39,8.44,9928300,8.41
2012-08-29,8.52,8.59,8.45,8.54,12696200,8.51
2012-08-28,8.47,8.57,8.45,8.50,10328900,8.47
2012-08-27,8.67,8.68,8.46,8.48,11854500,8.45
2012-08-24,8.61,8.68,8.55,8.63,10426900,8.60
2012-08-23,8.80,8.82,8.62,8.63,12590200,8.60
2012-08-22,8.77,8.87,8.67,8.87,13302000,8.84
2012-08-21,8.83,8.95,8.80,8.82,13825500,8.79
2012-08-20,8.74,8.83,8.69,8.80,9049200,8.77
2012-08-17,8.76,8.85,8.70,8.75,10868700,8.72
2012-08-16,8.71,8.83,8.69,8.77,10961800,8.74
2012-08-15,8.66,8.76,8.63,8.73,8656600,8.70
2012-08-14,8.89,8.93,8.63,8.69,12091700,8.66
2012-08-13,8.91,8.97,8.80,8.83,10773700,8.80
2012-08-10,8.77,8.98,8.68,8.98,18213900,8.95
2012-08-09,8.79,8.91,8.77,8.86,16897700,8.83
2012-08-08,8.55,8.80,8.51,8.80,21222500,8.77
2012-08-07,8.54,8.64,8.50,8.60,14630700,8.57
2012-08-06,8.39,8.57,8.38,8.50,18087400,8.47
2012-08-03,8.31,8.45,8.26,8.37,14634300,8.34
2012-08-02,8.32,8.41,8.10,8.18,21618900,8.15
2012-08-01,8.49,8.58,8.37,8.43,28391900,8.40
2012-07-31,8.43,8.52,8.40,8.47,14899200,8.41
2012-07-30,8.47,8.48,8.30,8.45,14158700,8.39
2012-07-27,8.22,8.52,8.15,8.45,27339500,8.39
2012-07-26,8.15,8.20,8.01,8.19,21521200,8.13
2012-07-25,8.07,8.13,7.97,8.02,23445900,7.96
2012-07-24,8.13,8.17,7.97,8.02,27649700,7.96
2012-07-23,8.14,8.15,8.02,8.14,20248400,8.08
2012-07-20,8.31,8.37,8.25,8.26,13841900,8.20
2012-07-19,8.35,8.44,8.33,8.38,16537000,8.32
2012-07-18,8.27,8.39,8.22,8.33,16838400,8.27
2012-07-17,8.40,8.40,8.22,8.28,34517400,8.22
2012-07-16,8.41,8.42,8.30,8.33,15213900,8.27
2012-07-13,8.35,8.43,8.27,8.42,18762500,8.36
2012-07-12,8.28,8.38,8.21,8.30,26948000,8.24
2012-07-11,8.36,8.42,8.30,8.35,26367400,8.29
2012-07-10,8.82,8.88,8.34,8.40,57151400,8.34
2012-07-09,8.64,8.77,8.57,8.76,35405200,8.70
2012-07-06,8.79,8.79,8.61,8.73,25221900,8.67
2012-07-05,8.87,9.06,8.84,8.92,18930400,8.86
2012-07-03,8.70,9.00,8.69,8.90,17537100,8.84
2012-07-02,8.74,8.77,8.59,8.63,21355500,8.57
2012-06-29,8.68,8.75,8.59,8.75,26618200,8.69
2012-06-28,8.42,8.52,8.35,8.51,16464500,8.45
2012-06-27,8.42,8.59,8.28,8.53,24958900,8.47
2012-06-26,8.42,8.50,8.32,8.39,25529600,8.33
2012-06-25,8.50,8.50,8.36,8.39,19209400,8.33
2012-06-22,8.57,8.66,8.50,8.62,25744000,8.56
2012-06-21,8.88,8.89,8.52,8.55,22472900,8.49
2012-06-20,8.88,9.00,8.83,8.92,21348100,8.86
2012-06-19,8.73,8.94,8.71,8.90,16215900,8.84
2012-06-18,8.74,8.77,8.62,8.69,14043700,8.63
2012-06-15,8.73,8.82,8.65,8.82,16952400,8.76
2012-06-14,8.48,8.66,8.42,8.65,19365700,8.59
2012-06-13,8.43,8.61,8.41,8.48,22805800,8.42
2012-06-12,8.35,8.52,8.34,8.52,18083300,8.46
2012-06-11,8.61,8.68,8.31,8.32,17287900,8.26
2012-06-08,8.47,8.54,8.35,8.52,16656300,8.46
2012-06-07,8.80,8.91,8.52,8.55,23130500,8.49
2012-06-06,8.54,8.67,8.37,8.64,17017700,8.58
2012-06-05,8.42,8.52,8.32,8.45,16539800,8.39
2012-06-04,8.27,8.39,8.21,8.39,22771900,8.33
2012-06-01,8.39,8.48,8.29,8.30,24644200,8.24
2012-05-31,8.58,8.62,8.39,8.55,25768400,8.49
2012-05-30,8.76,8.79,8.53,8.58,18627600,8.52
2012-05-29,8.78,8.92,8.75,8.89,25746400,8.83
2012-05-25,8.54,8.67,8.54,8.63,15270600,8.57
2012-05-24,8.61,8.64,8.43,8.63,23696300,8.57
2012-05-23,8.40,8.61,8.31,8.61,24261600,8.55
2012-05-22,8.66,8.73,8.41,8.49,24774400,8.43
2012-05-21,8.49,8.61,8.45,8.60,15157500,8.54
2012-05-18,8.55,8.68,8.38,8.43,26960000,8.37
2012-05-17,8.52,8.71,8.42,8.50,34938700,8.44
2012-05-16,8.76,8.88,8.48,8.49,30217000,8.43
2012-05-15,8.94,9.01,8.68,8.71,27790400,8.65
2012-05-14,8.97,9.12,8.92,8.92,18800800,8.86
2012-05-11,8.99,9.18,8.99,9.06,16524500,9.00
2012-05-10,9.23,9.25,9.03,9.10,17843400,9.04
2012-05-09,9.07,9.27,9.00,9.15,23035100,9.06
2012-05-08,9.24,9.28,9.03,9.21,25109600,9.12
2012-05-07,9.31,9.41,9.20,9.33,18031400,9.23
2012-05-04,9.50,9.52,9.34,9.37,17550100,9.27
2012-05-03,9.76,9.77,9.55,9.58,18177300,9.48
2012-05-02,9.85,9.88,9.68,9.73,18199700,9.63
2012-05-01,9.74,10.01,9.67,9.97,27767100,9.87
2012-04-30,9.70,9.79,9.64,9.73,16375600,9.63
2012-04-27,9.87,9.90,9.70,9.75,20329400,9.65
2012-04-26,9.77,9.89,9.72,9.86,17642400,9.76
2012-04-25,9.77,9.86,9.67,9.82,20304800,9.72
2012-04-24,9.63,9.76,9.60,9.66,14937900,9.56
2012-04-23,9.54,9.67,9.47,9.63,21440300,9.53
2012-04-20,9.85,9.93,9.67,9.70,19898800,9.60
2012-04-19,9.95,10.01,9.70,9.76,32979500,9.66
2012-04-18,9.94,10.07,9.89,9.95,23887900,9.85
2012-04-17,9.91,10.07,9.90,9.99,20410200,9.89
2012-04-16,9.94,9.95,9.73,9.86,26935000,9.76
2012-04-13,10.08,10.13,9.82,9.85,26941600,9.75
2012-04-12,9.99,10.24,9.96,10.17,37598200,10.07
2012-04-11,9.94,10.15,9.88,9.90,79889400,9.80
2012-04-10,9.62,9.65,9.31,9.32,45919100,9.22
2012-04-09,9.51,9.72,9.46,9.60,23679700,9.50
2012-04-05,9.77,9.89,9.58,9.63,24541400,9.53
2012-04-04,9.89,9.99,9.76,9.81,24616500,9.71
2012-04-03,10.11,10.18,9.97,10.06,30141300,9.96
2012-04-02,9.93,10.24,9.93,10.17,18685300,10.07
2012-03-30,10.13,10.15,9.98,10.02,20150800,9.92
2012-03-29,9.77,10.09,9.75,10.03,28959000,9.93
2012-03-28,10.06,10.06,9.79,9.83,36435200,9.73
2012-03-27,10.25,10.31,10.06,10.06,19193300,9.96
2012-03-26,10.25,10.30,10.12,10.22,13772200,10.12
2012-03-23,10.01,10.26,9.96,10.11,20016500,10.01
2012-03-22,10.17,10.19,9.95,10.01,28676600,9.91
2012-03-21,10.44,10.45,10.25,10.27,18036300,10.16
2012-03-20,10.46,10.50,10.27,10.44,21437000,10.33
2012-03-19,10.51,10.75,10.51,10.60,18822000,10.49
2012-03-16,10.40,10.62,10.38,10.54,30936100,10.43
2012-03-15,10.26,10.38,10.17,10.35,27002700,10.24
2012-03-14,10.34,10.38,10.21,10.28,28992100,10.17
2012-03-13,10.00,10.36,9.95,10.31,40257800,10.20
"""
if __name__ == '__main__':
main()
Process: Python [37153]
Path: /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python
Identifier: Python
Version: 2.7.2 (2.7.2)
Code Type: X86-64 (Native)
Parent Process: bash [36339]
User ID: 501
Date/Time: 2012-12-28 14:06:07.662 -0600
OS Version: Mac OS X 10.8.2 (12C3012)
Report Version: 10
Sleep/Wake UUID: E29FE5CB-6D0F-40F3-BD41-93344643202F
Crashed Thread: 2
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
---
Thread 2 Crashed:
0 libsystem_kernel.dylib 0x00007fff86953212 __pthread_kill + 10
1 libsystem_c.dylib 0x00007fff902e5af4 pthread_kill + 90
2 libsystem_c.dylib 0x00007fff90329dce abort + 143
3 org.python.python 0x0000000102066eaa Py_FatalError + 49
4 org.python.python 0x00000001020aa895 PyTuple_New + 257
5 org.python.python 0x0000000102032788 0x102015000 + 120712
6 org.python.python 0x000000010202e687 PyEval_EvalFrameEx + 9466
7 org.python.python 0x0000000102032869 0x102015000 + 120937
8 org.python.python 0x000000010202e63a PyEval_EvalFrameEx + 9389
9 org.python.python 0x000000010202c147 PyEval_EvalCodeEx + 1934
10 org.python.python 0x00000001020328df 0x102015000 + 121055
11 org.python.python 0x000000010202e63a PyEval_EvalFrameEx + 9389
12 org.python.python 0x000000010202c147 PyEval_EvalCodeEx + 1934
13 org.python.python 0x00000001020328df 0x102015000 + 121055
14 org.python.python 0x000000010202e63a PyEval_EvalFrameEx + 9389
15 org.python.python 0x0000000102032869 0x102015000 + 120937
16 org.python.python 0x000000010202e63a PyEval_EvalFrameEx + 9389
17 org.python.python 0x000000010202c147 PyEval_EvalCodeEx + 1934
18 org.python.python 0x00000001020328df 0x102015000 + 121055
19 org.python.python 0x000000010202e63a PyEval_EvalFrameEx + 9389
20 org.python.python 0x000000010202c147 PyEval_EvalCodeEx + 1934
21 org.python.python 0x00000001020328df 0x102015000 + 121055
22 org.python.python 0x000000010202e63a PyEval_EvalFrameEx + 9389
23 org.python.python 0x0000000102032869 0x102015000 + 120937
24 org.python.python 0x000000010202e63a PyEval_EvalFrameEx + 9389
25 org.python.python 0x000000010202c147 PyEval_EvalCodeEx + 1934
26 org.python.python 0x00000001020328df 0x102015000 + 121055
27 org.python.python 0x000000010202e63a PyEval_EvalFrameEx + 9389
28 org.python.python 0x000000010202c147 PyEval_EvalCodeEx + 1934
29 org.python.python 0x0000000102065d7a 0x102015000 + 331130
30 org.python.python 0x00000001020246c6 PyObject_Call + 97
31 org.python.python 0x000000010202cf82 PyEval_EvalFrameEx + 3573
32 org.python.python 0x0000000102032869 0x102015000 + 120937
33 org.python.python 0x000000010202e63a PyEval_EvalFrameEx + 9389
34 org.python.python 0x0000000102032869 0x102015000 + 120937
35 org.python.python 0x000000010202e63a PyEval_EvalFrameEx + 9389
36 org.python.python 0x000000010202c147 PyEval_EvalCodeEx + 1934
37 org.python.python 0x0000000102065d7a 0x102015000 + 331130
38 org.python.python 0x00000001020246c6 PyObject_Call + 97
39 org.python.python 0x00000001020419bf 0x102015000 + 182719
40 org.python.python 0x00000001020246c6 PyObject_Call + 97
41 org.python.python 0x0000000102032018 PyEval_CallObjectWithKeywords + 177
42 org.python.python 0x000000010208e7f6 0x102015000 + 497654
43 libsystem_c.dylib 0x00007fff902e4742 _pthread_start + 327
44 libsystem_c.dylib 0x00007fff902d1181 thread_start + 13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment