First page Back Continue Last page Overview Image

Reading csv Files

We want to read in a csv file with the population data of all countries (July 2014). The delimiter of the file a a space and commas are used to separate groups of thousands in the numbers:

pop = pd.read_csv("countries_population.csv",

header=None,

names=["Country", "Population"],

index_col=0,

quotechar="'",

sep=" ",

thousands=",")

print(pop)

Population

Country

China 1355692576

India 1236344631

European Union 511434812

United States 318892103

Indonesia 253609643

Brazil 202656788

Pakistan 196174380

...