python - Subsetting data in pandas with complex operations -


i have dataset looks this:

year_week  selling_amount  201012     43  201112     44 -1-1       56 

now there anomaly here. 1 simple way of checking if year_week has entry has size less 6. how can in pandas ?

how about:

criterion = df['year_week'].map(lambda x: len(x)< 6) df[criterion].index.values 

this works if leave dtype string , change int later.


Comments

Popular posts from this blog

IF statement in MySQL trigger -

c++ - What does MSC in "// appease MSC" comments mean? -

javascript - Blogger related post gadget image Resize s72-c [ Need Expert Help ] -