Tutorial by Examples

.iloc uses integers to read and write data to a DataFrame. First, let's create a DataFrame: df = pd.DataFrame({'one': [1, 2, 3, 4, 5], 'two': [6, 7, 8, 9, 10], }, index=['a', 'b', 'c', 'd', 'e']) This DataFrame looks like: one two a 1 6 b 2 ...
.loc uses labels to read and write data. Let's setup a DataFrame: df = pd.DataFrame({'one': [1, 2, 3, 4, 5], 'two': [6, 7, 8, 9, 10], }, index=['a', 'b', 'c', 'd', 'e']) Then we can print the DataFrame to have a look at the shape: print df This will o...

Page 1 of 1