Strange output with Python Lists

Viewed 44

I have a dataframe: Outlet_results it goes something like this

index  Calendar year/Week     Material    Sellthru Qty
0           37.2013            ABC          2
1           38.2913            ABC          7
2           37.2913            BCG          22
3           39.2013            XYZ          5

Now, I wanted a separate list for the Materials and week for further coding.

I used this code for the material list

mat_outlet = list(set(outlet_result['Material']))

It works perfectly and gives me 3 values (ABC, BCG, XYZ)

However, the week list shows a faulty output even though the code is same.

week_outlet_list = list(set(outlet_result['Calendar Year/Week']))

I am getting a list with 4 values ['38.2013', '37.2013', 'Calendar Year/Week', '39.2013']

Why is the string (header) included in the list? Please help me understand this concept.

I am using Python 2.7.... has it got something to do with it?

0 Answers
Related