Side note: Python 3 also supports using Unicode characters in identifiers: répertoire="/tmp/records.log"withopen(répertoire,"w")asf:f.write("test\n") If you can't enter a particular character in your editor or want to keep the source code ASCII-only for some reason, you can also use...
Another way to filter data is using theisin. Following is the code to filter only 2 states ‘Karnataka’ and ‘Tamil Nadu’. print(df[df['State'].isin(['Karnataka', 'Tamil Nadu'])]) Output: 5. Rename column It is possible to use thedf.rename()function to rename a column. The fu...