Lecture notes - Indexing and selecting 1. To select the multiple columns: put list into the square bracket 2. Slicing rows with numbers can be confusing: iloc can help you 3. filter data using a boolean series(using loc can be faster) 4. Multi index: very confusing -> use df.reset_index() or df.reset_index(level=0) (certain index out) 5. You can append index - df.set_index('abc', append=True) 6. get 'single' value : using loc can be very slow, use df.at[row,column]
@ExcelTutorials12 жыл бұрын
That was very helpful! I am good with msexcel, but trying to build my Python skills and this helped a lot!
@kinjalvora33524 жыл бұрын
Hi Nathan, Just wondering: I see that loc is all inclusive so if you are mentioning 2:4, it includes 4 as well, whereas iloc is not. Is that also a reason to maybe use loc more than iloc?
@DataTalks4 жыл бұрын
I generally use loc because of clarity! You can easily understand what you are selecting because the column names are written out explicitly ;)