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

android - How to save instance state of selected radiobutton on menu -

python 3 IndexError: list index out of range -

IF statement in MySQL trigger -