reset_index replaces a DataFrame's current index with a default integer index. It is useful after filtering, concatenating, grouping, or creating an index from a data column. section 6.12 section 11.18
Choose whether the displaced index should remain available:
- Use reset_index() when the old index should become a regular column. section 6.12
- Use reset_index(drop=True) when the old index is no longer useful and should be discarded. section 11.16 section 11.18
- Check df.index.is_unique when plotting tools may reject repeated index values. section 11.18
Prepare concatenated data for plotting
After combining January and July taxi data, check the index and renumber the rows: df.index.is_unique; df = df.reset_index(drop=True). The resulting DataFrame has unique default row numbers, allowing Seaborn relationship and line plots to proceed without index-related errors. section 11.18 section 11.16
df = df.reset_index(drop=True)
Run the concise reset_index(drop=True) operation used to replace an unsuitable index before visualization. section 11.16
