Hello everyone, I am working on a dataset and I ran into a problem of data types, here is a view of its first few rows:
Country | Population | Capital | Date of Independence | GDP per Capita ($) |
---|---|---|---|---|
USA | 331,002,651 | Washington, D.C. | July 4, 1776 | 63,416 |
China | 1,439,323,776 | Beijing | October 1, 1949 | 10,262 |
Brazil | 212,559,417 | Brasília | September 7, 1822 | 8,687 |
Australia | 25,499,884 | Canberra | January 1, 1901 | 55,714 |
France | 65,273,511 | Paris | July 14, 1789 | 44,550 |
Now, as you can see, there are different columns and some are numeric, some are non-numerical and I also have a column of dates. All these columns are loaded as object
when I read the CSV
file and I want to change the types of the columns to their correct types. Please provide me with different efficient methods of doing this, use example codes if possible as they help me understand better.