Q:

How to insert into pandas dataframe by alphabetical order of a column? 

Now I have this:
#old df:

bar foo
1   a
3   b
5   z

I want to insert a line [6,"d"], so the df becomes:
#new df:

bar foo
1   a
3   b
6   d
5   z

A:

You can using append
df.append(pd. DataFrame([[6,"d"]],columns=df.columns)).sort_values('foo').reset_index(drop=True)
Out[46]: 
   bar foo
0    1   a
1    3   b
2    6   d
3    5   z

Also np.searchsorted is to find the index order of inserted value in original df
pd.concat([df,pd. DataFrame([[6,"d"]],columns=df.columns,index=np.searchsorted(df.foo,['d'])-1)]).sort_index()
Out[69]: 
   bar foo
0    1   a
1    3   b
1    6   d
2    5   z

