<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Load iqsize.csv using pd.read_csv
Step1:  Print both column and row indexes
Step2:  One common property of the dataframe to check is the size (in terms of number of rows and columns)
Step3:  Print column dtype an think if they have the proper variable type
Series are iterable, so we can iterate through df.columns and then check the dtype of each series
Step4:  This is a correct way of checking variable names, note
Step5:  The result is a series, so we can still do transformations on the result
Step6:  We can use df1.dtypes to select only integer columns
Step7:  What happened here?
From inner to outer operations
Step8:  we slice df1.dtypes Series using result1 series. Note that the result is a Series containing the values of the dtypes of the original dataframe
Step9:  If we want to select the columns instead of the values, we need the indexes
Step10:  We can get the same result using result1 to slice df1.columns
Step11:  Once we have the column names we just need to slice the original dataframe using result2
Step12:  Think if they have the proper variable type
Step13:  Use DataFrame.loc and DataFrame.iloc to (in each case print the result and check what data type you obtain as reponse)
Step14:  We can also use loc
Step15:  B. Get the third row
Using iloc
Step16:  Using loc
Step17:  C. Get all but last column
Step18:  D. Get rows from 4 to 10
Step19:  E. Get values from columns 2 and 3 containing 3 and 4 row values
Using iloc
Step20:  Using loc
Step21:  F. Get all iq values grater than 100
Step22:  G. Divide previous results by 100
Step23:  Extra
Step24:  We can as well apply the methods for de computation of each one of the statistics (e.g. max, mean, std)
Step25:  Extra
<ASSISTANT_TASK:>
Python Code:
df1 = pd.read_csv("../data/iqsize.csv")
# we can apply head method, it will return the n first rows
# n = 5 as a default value
df1.head(10)
Explanation: Load iqsize.csv using pd.read_csv
End of explanation
print("Columns: {}".format(df1.columns))
print("Rows: {}".format(df1.index))
Explanation: Print both column and row indexes
End of explanation
df1.shape
Explanation: One common property of the dataframe to check is the size (in terms of number of rows and columns)
End of explanation
for column in df1.columns:
    print("column name: {} - dtype: {}".format(column, df1[column].dtype))
Explanation: Print column dtype an think if they have the proper variable type
Series are iterable, so we can iterate through df.columns and then check the dtype of each series
End of explanation
df1.dtypes
Explanation: This is a correct way of checking variable names, note:
   * If we want to analyse the results, we have to create new structures to store the values
   * We are iterating using a for loop and wirting custom code
We can access directly DataFrame dtypes this way
End of explanation
type(df1.dtypes)
Explanation: The result is a series, so we can still do transformations on the result
End of explanation
df1[df1.dtypes[df1.dtypes == np.int64].index].head()
Explanation: We can use df1.dtypes to select only integer columns
End of explanation
result1 = df1.dtypes == np.int64
display(result1)
type(result1)
Explanation: What happened here?
From inner to outer operations:
0. note that df1.dtypes is a Series object
1. we check which dtypes are int64 just comparing all values to np.int64. The equality operation is performed to all elementos of df1.dtypes. This operation returns a Boolean Series object
End of explanation
df1.dtypes[result1]
Explanation: we slice df1.dtypes Series using result1 series. Note that the result is a Series containing the values of the dtypes of the original dataframe
End of explanation
result2 = df1.dtypes[result1].index
display(result2)
Explanation: If we want to select the columns instead of the values, we need the indexes
End of explanation
df1.columns[result1]
Explanation: We can get the same result using result1 to slice df1.columns
End of explanation
df1[result2].head()
Explanation: Once we have the column names we just need to slice the original dataframe using result2
End of explanation
df1.dtypes
Explanation: Think if they have the proper variable type
End of explanation
df1.iloc[:,1].head()
Explanation: Use DataFrame.loc and DataFrame.iloc to (in each case print the result and check what data type you obtain as reponse):
Get the second column
Using iloc:
End of explanation
df1.columns
df1.columns[1]
df1.loc[:,'piq'].head()
df1.loc[:,df1.columns[1]].head()
print(type(df1.loc[:,df1.columns[1]].head()))
Explanation: We can also use loc
End of explanation
df1.iloc[3,:]
Explanation: B. Get the third row
Using iloc
End of explanation
df1.loc[3,:]
print(type(df1.loc[3,:]))
Explanation: Using loc
End of explanation
df1.columns
df1.columns[:-1]
df1.loc[:,df1.columns[:-1]].head()
print(type(df1.loc[:,df1.columns[:-1]].head()))
Explanation: C. Get all but last column
End of explanation
df1.iloc[4:11,:]
print(type(df1.iloc[4:11,:]))
Explanation: D. Get rows from 4 to 10
End of explanation
df1.iloc[2:4,3:5]
print(type(df1.iloc[2:4,3:5]))
Explanation: E. Get values from columns 2 and 3 containing 3 and 4 row values
Using iloc
End of explanation
df1.columns
df1.columns[3:5]
df1.loc[2:3,["height","weight"]]
df1.loc[2:3,df1.columns[3:5]]
Explanation: Using loc
End of explanation
df1.loc[df1.loc[:,"weight"] > 136,"weight"].head()
Explanation: F. Get all iq values grater than 100
End of explanation
(df1.loc[df1.loc[:,"weight"] > 136,"weight"] / 100).head()
Explanation: G. Divide previous results by 100
End of explanation
df1.describe()
Explanation: Extra: methods for quantitative variables
DataFrame.describe() returns a set of statistical measures of the quantitative variables of the dataset.
End of explanation
df1["brain"].max()
df1["brain"].mean()
df1["brain"].std()
Explanation: We can as well apply the methods for de computation of each one of the statistics (e.g. max, mean, std)
End of explanation
s = df1["sex"]
s.value_counts()
Explanation: Extra: methods for qualitative variables
End of explanation
<END_TASK>