Loading tutorials
df.columns and spot the problems that later chapters fix.2 min readdf.columns. Here you change some of them.2 min readrename(), and call basic string methods such as strip and lower. A dictionary works well when you rename a few columns. If every label needs the same fix, a function is shorter and cannot miss a column.2 min readdf.columns, and work with Python lists. You have already seen rename() change selected labels. Here you replace every label in one step by assigning to df.columns.2 min readstrip and lower. Real data often arrives with labels like " Order ID" or "Total $". These labels have stray spaces, mixed case, and symbols, so you can't use attribute access 2 min readrename(), and read df.columns. Most rename bugs fail silently, so you see no error and the labels simply stay the same.2 min readduplicated() and drop_duplicates() in the next chapters.2 min readduplicated() flags repeated rows. Removing them comes in the next chapter.2 min readduplicated(), which flags repeated rows.2 min readduplicated() flags repeated rows and drop_duplicates() removes them.2 min readduplicated() and drop_duplicates() at a basic level. Here you will see what drop_duplicates() does to the row labels, why that matters, and how to control it.2 min readdrop_duplicates() with subset and keep. Here you combine sorting with deduplication to keep the most recent row for each key.2 min readduplicated(), drop_duplicates() with subset and keep, and the .str accessor from the earlier chapters.2 min readrename() and assign to df.columns. It also assumes you know what a boolean mask is. Everything so far has treated duplicates as repeated rows. Here the repeats are in the column labels themselves, which pandas allows but which causes problems.2 min readrename() and drop_duplicates() as covered earlier. It shows how to confirm that each step did what you intended before you rely on the data.2 min read