This minimal code crashes my Python. (Setting: pandas 0.13.0, python 2.7.3 AMD64, Win7.)
import pandas as pd
input_file = r"c3.csv"
input_df = pd.read_csv(input_file)
for col in input_df.columns: # strip whitespaces from string values
if input_df[col].dtype == object:
input_df[col] = input_df[col].apply(lambda x: x.strip())
print 'start'
for idx in range(len(input_df)):
input_df['LL'].iloc[idx] = 3
print idx
print 'finished'
Output:
start
0
Process finished with exit code -1073741819
What prevents the crash:
- Removing lines from c3.csv.
- Removing
.strip()
from the code. - Changing c3.csv changes the amount of
for
iterations until the crash in unexpected ways.
Contents of c3.csv:
Size , B/S , Symbol , Type , BN , Duration , VR , Time , SR ,LL,
0, xxxx , xxxx0 , ,, xxx , 00000 , 00:00:00 , 000000000 , 00:00:00 ,
0, xxxx , xxxxx , ,, xxx , 00000 , 00:00:00 , 000000000 , 00:00:00 ,
0, xxxx , xxxxx , ,, xxx , 00000 , 00:00:00 , 000000000 , 00:00:00 ,
0, xxxx , xxxxx , ,, xxx , 00000 , 00:00:00 , 000000000 , 00:00:00 ,
0, xxxx , xxxxx , ,, xxx , 00000 , 00:00:00 , 000000000 , 00:00:00 ,
0, xxxx , xxxxx , ,, xxx , 00000 , 00:00:00 , 000000000 , 00:00:00 ,
0, xxxx , xxxxx , ,, xxx , 00000 , 00:00:00 , 000000000 , 00:00:00 ,
0, xxxx , xxxxx , ,, xxx , 00000 , 00:00:00 , 000000000 , 00:00:00 ,
0, xxxx , xxxxx , ,, xxx , 00000 , 00:00:00 , 000000000 , 00:00:00 ,
0, xxxx , xxxxx , ,, xxx , 00000 , 00:00:00 , 000000000 , 00:00:00 ,
0, xxxx , xxxxx , ,, xxx , 00000 , 00:00:00 , 000000000 , 00:00:00 ,
0, xxxx , xxxxx , ,, xxx , 00000 , 00:00:00 , 000000000 , 00:00:00 ,
0, xxxx , xxxxx , ,, xxx , 00000 , 00:00:00 , 000000000 , 00:00:00 ,
0, xxxx , xxxxx , ,, xxx , 00000 , 00:00:00 , 000000000 , 00:00:00 ,
0, xxxx , xxxxx , ,, xxx , 00000 , 00:00:00 , 000000000 , 00:00:00 ,
0, xxxx , xxxxx , ,, xxx , 00000 , 00:00:00 , 000000000 , 00:00:00 ,
0, xxxx , xxxxx , ,, xxx , 00000 , 00:00:00 , 000000000 , 00:00:00 ,
0, xxxx , xxxxx , ,, xxx , 00000 , 00:00:00 , 000000000 , 00:00:00 ,
0, xxxx , xxxxx , ,, xxx , 00000 , 00:00:00 , 000000000 , 00:00:00 ,
0, xxxx , xxxxx , ,, xxx , 00000 , 00:00:00 , 000000000 , 00:00:00 ,
0, xxx , xxxxx , ,, xxx , 00000 , 00:00:00 , 000000000 , 00:00:00 ,
0, xxx , xxxxx , ,, xxx , 00000 , 00:00:00 , 000000000 , 00:00:00 ,
0, xxxx , xxxxx , ,, xxx , 00000 , 00:00:00 , 000000000 , 00:00:00 ,
0, xxxx , xxxxx , ,, xxx , 00000 , 00:00:00 , 000000000 , 00:00:00 ,
0, xxxx , xxxxx , ,, xxx , 00000 , 00:00:00 , 000000000 , 00:00:00 ,
0, xxxx , xxxxx , ,, xxx , 00000 , 00:00:00 , 000000000 , 00:00:00 ,
0, xxxx , xxxxx , ,, xxx , 00000 , 00:00:00 , 000000000 , 00:00:00 ,
0, xxxx , xxxxx , ,, xxx , 00000 , 00:00:00 , 000000000 , 00:00:00 ,
0, xxx , xxxxx , ,, xxx , 00000 , 00:00:00 , 000000000 , 00:00:00 ,
0, xxx , xxxxx , ,, xxx , 00000 , 00:00:00 , 000000000 , 00:00:00 ,
0, xxxx , xxxxx , ,, xxx , 00000 , 00:00:00 , 000000000 , 00:00:00 ,
0, xxxx , xxxxx , ,, xxx , 00000 , 00:00:00 , 000000000 , 00:00:00 ,
0, xxx , xxxxx , ,, xxx , 00000 , 00:00:00 , 000000000 , 00:00:00 ,
0, xxxx , xxxxx , ,, xxx , 00000 , 00:00:00 , 000000000 , 00:00:00 ,
0, xxxx , xxxxx , ,, xxx , 00000 , 00:00:00 , 000000000 , 00:00:00 ,
0, xxx , xxxxx , ,, xxx , 00000 , 00:00:00 , 000000000 , 00:00:00 ,
0, xxxx , xxxxx , ,, xxx , 00000 , 00:00:00 , 000000000 , 00:00:00 ,
0, xxx , xxxxx , ,, xxx , 00000 , 00:00:00 , 000000000 , 00:00:00 ,
0, xxxx , xxxxx , ,, xxx , 00000 , 00:00:00 , 000000000 , 00:00:00 ,
0, xxx , xxxxx , ,, xxx , 00000 , 00:00:00 , 000000000 , 00:00:00 ,
0, xxx , xxxxx , ,, xxx , 00000 , 00:00:00 , 000000000 , 00:00:00 ,
0, xxxx , xxxxx , ,, xxx , 00000 , 00:00:00 , 000000000 , 00:00:00 ,
0, xxxx , xxxxx , ,, xxx , 00000 , 00:00:00 , 000000000 , 00:00:00 ,
0, xxx , xxxxx , ,, xxx , 00000 , 00:00:00 , 000000000 , 00:00:00 ,
0, xxx , xxxxx , ,, xxx , 00000 , 00:00:00 , 000000000 , 00:00:00 ,
0, xxx , xxxxx , ,, xxx , 00000 , 00:00:00 , 000000000 , 00:00:00 ,
0, xxxx , xxxxx , ,, xxx , 00000 , 00:00:00 , 000000000 , 00:00:00 ,
0, xxxx , xxxxx , ,, xxx , 00000 , 00:00:00 , 000000000 , 00:00:00 ,
0, xxxx , xxxxx , ,, xxx , 00000 , 00:00:00 , 000000000 , 00:00:00 ,
0, xxx , xxxxx , ,, xxx , 00000 , 00:00:00 , 000000000 , 00:00:00 ,
0, xxx , xxxxx , ,, xxx , 00000 , 00:00:00 , 000000000 , 00:00:00 ,
0, xxx , xxxxx , ,, xxx , 00000 , 00:00:00 , 000000000 , 00:00:00 ,
0, xxxx , xxxxx , ,, xxx , 00000 , 00:00:00 , 000000000 , 00:00:00 ,
0, xxxx , xxxxx , ,, xxx , 00000 , 00:00:00 , 000000000 , 00:00:00 ,
0, xxxx , xxxxx , ,, xxx , 00000 , 00:00:00 , 000000000 , 00:00:00 ,
0, xxx , xxxxx , ,, xxx , 00000 , 00:00:00 , 000000000 , 00:00:00 ,
0, xxx , xxxxx , ,, xxx , 00000 , 00:00:00 , 000000000 , 00:00:00 ,
0, xxx , xxxxx , ,, xxx , 00000 , 00:00:00 , 000000000 , 00:00:00 ,
0, xxx , xxxxx , ,, xxx , 00000 , 00:00:00 , 000000000 , 00:00:00 ,
0, xxxx , xxxxx , ,, xxx , 00000 , 00:00:00 , 000000000 , 00:00:00 ,
0, xxxx , xxxxx , ,, xxx , 00000 , 00:00:00 , 000000000 , 00:00:00 ,
0, xxx , xxxxx , ,, xxx , 00000 , 00:00:00 , 000000000 , 00:00:00 ,
0, xxx , xxxxx , ,, xxx , 00000 , 00:00:00 , 000000000 , 00:00:00 ,
0, xxxx , xxxxx , ,, xxx , 00000 , 00:00:00 , 000000000 , 00:00:00 ,
0, xxxx , xxxxx , ,, xxx , 00000 , 00:00:00 , 000000000 , 00:00:00 ,
0, xxx , xxxxx , ,, xxx , 00000 , 00:00:00 , 000000000 , 00:00:00 ,
0, xxxx , xxxxx , ,, xxx , 00000 , 00:00:00 , 000000000 , 00:00:00 ,
0, xxx , xxxxx , ,, xxx , 00000 , 00:00:00 , 000000000 , 00:00:00 ,
0, xxxx , xxxxx , ,, xxx , 00000 , 00:00:00 , 000000000 , 00:00:00 ,
0, xxx , xxxxx , ,, xxx , 00000 , 00:00:00 , 000000000 , 00:00:00 ,
0, xxxx , xxxxx , ,, xxx , 00000 , 00:00:00 , 000000000 , 00:00:00 ,
0, xxxx , xxxxx , ,, xxx , 00000 , 00:00:00 , 000000000 , 00:00:00 ,
00, xxxx , xxxxx , ,, xxx , 00000 , 00:00:00 , 000000000 , 00:00:00 ,
0, xxx , xxxxx , ,, xxx , 00000 , 00-00:00:00 , 000000000 , 00-00:00:00 ,
0, xxx , xxxxx , ,, xxx , 00000 , 00-00:00:00 , 000000000 , 00-00:00:00 ,
0, xxx , xxxxx , ,, xxx , 00000 , 00-00:00:00 , 000000000 , 00-00:00:00 ,
0, xxx , xxxxx , ,, xxx , 00000 , 00-00:00:00 , 000000000 , 00-00:00:00 ,
0, xxx , xxxxx , ,, xxx , 00000 , 00-00:00:00 , 000000000 , 00-00:00:00 ,
0, xxx , xxxxx , ,, xxx , 00000 , 00-00:00:00 , 000000000 , 00-00:00:00 ,
0, xxx , xxxxx , ,, xxx , 00000 , 00-00:00:00 , 000000000 , 00-00:00:00 ,
0, xxxx , xxxxx , ,, xxx , 00000 , 00-00:00:00 , 000000000 , 00-00:00:00 ,
0, xxxx , xxxxx , ,, xxx , 00000 , 00-00:00:00 , 000000000 , 00-00:00:00 ,
0, xxx , xxxxx , ,, xxx , 00000 , 00-00:00:00 , 000000000 , 00-00:00:00 ,
0, xxx , xxxxx , ,, xxx , 00000 , 00-00:00:00 , 000000000 , 00-00:00:00 ,
0, xxx , xxxxx , ,, xxx , 00000 , 00-00:00:00 , 000000000 , 00-00:00:00 ,
0, xxx , xxxxx , ,, xxx , 00000 , 00-00:00:00 , 000000000 , 00-00:00:00 ,
0, xxx , xxxxx , ,, xxx , 00000 , 00-00:00:00 , 000000000 , 00-00:00:00 ,
0, xxx , xxxxx , ,, xxx , 00000 , 00-00:00:00 , 000000000 , 00-00:00:00 ,
0, xxx , xxxxx , ,, xxx , 00000 , 00-00:00:00 , 000000000 , 00-00:00:00 ,
0, xxx , xxxxx , ,, xxx , 00000 , 00-00:00:00 , 000000000 , 00-00:00:00 ,
0, xxx , xxxxx , ,, xxx , 00000 , 00-00:00:00 , 000000000 , 00-00:00:00 ,
0, xxx , xxxxx , ,, xxx , 00000 , 00-00:00:00 , 000000000 , 00-00:00:00 ,
0, xxxx , xxxxx , ,, xxx , 00000 , 00-00:00:00 , 000000000 , 00-00:00:00 ,
0, xxx , xxxxx , ,, xxx , 00000 , 00-00:00:00 , 000000000 , 00-00:00:00 ,
0, xxx , xxxxx , ,, xxx , 00000 , 00-00:00:00 , 000000000 , 00-00:00:00 ,
0, xxx , xxxxx , ,, xxx , 00000 , 00-00:00:00 , 000000000 , 00-00:00:00 ,
0, xxx , xxxxx , ,, xxx , 00000 , 00-00:00:00 , 000000000 , 00-00:00:00 ,
0, xxx , xxxxx , ,, xxx , 00000 , 00-00:00:00 , 000000000 , 00-00:00:00 ,
0, xxx , xxxxx , ,, xxx , 00000 , 00-00:00:00 , 000000000 , 00-00:00:00 ,
0, xxx , xxxxx , ,, xxx , 00000 , 00-00:00:00 , 000000000 , 00-00:00:00 ,
0, xxx , xxxxx , ,, xxx , 00000 , 00-00:00:00 , 000000000 , 00-00:00:00 ,
0, xxx , xxxxx , ,, xxx , 00000 , 00-00:00:00 , 000000000 , 00-00:00:00 ,
0, xxx , xxxxx , ,, xxx , 00000 , 00-00:00:00 , 000000000 , 00-00:00:00 ,
0, xxx , xxxxx , ,, xxx , 00000 , 00-00:00:00 , 000000000 , 00-00:00:00 ,
0, xxx , xxxxx , ,, xxx , 00000 , 00-00:00:00 , 000000000 , 00-00:00:00 ,
0, xxx , xxxxx , ,, xxx , 00000 , 00-00:00:00 , 000000000 , 00-00:00:00 ,
0, xxx , xxxxx , ,, xxx , 00000 , 00-00:00:00 , 000000000 , 00-00:00:00 ,
0, xxx , xxxxx , ,, xxx , 00000 , 00-00:00:00 , 000000000 , 00-00:00:00 ,
0, xxxx , xxxxx , ,, xxx , 00000 , 00-00:00:00 , 000000000 , 00-00:00:00 ,
0, xxxx , xxxxx , ,, xxx , 00000 , 00-00:00:00 , 000000000 , 00-00:00:00 ,
0, xxxx , xxxxx , ,, xxx , 00000 , 00-00:00:00 , 000000000 , 00-00:00:00 ,
0, xxxx , xxxxx , ,, xxx , 00000 , 00-00:00:00 , 000000000 , 00-00:00:00 ,