<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Differences between interactive and production work
Note
Step1:  selection using column name
Step2:  selection using slice
remember
Step3:  selection using date time index
note
Step4:  Selection by label
documentation
Step5:  Selecting using multi-axis by label
Step6:  Label slicing, both endpoints are included
Step7:  Reduce number of dimensions for returned object
notice order of 'D' and 'B'
Step8:  using result
Step9:  select a scalar
Step10:  Selection by Position
documentation
Step11:  integer slices
Step12:  lists of integers
Step13:  slicing rows explicitly
implicitly selecting all columns
Step14:  slicing columns explicitly
implicitly selecting all rows
Step15:  Boolean Indexing
test based upon one column's data
Step16:  test based upon entire data set
Step17:  isin() method
documentation
Step18:  select rows where 'Fruits' column contains eith 'banana' or 'pineapple'; notice 'smoothy', which is not in the column
<ASSISTANT_TASK:>
Python Code:
import pandas as pd
import numpy as np
sample_numpy_data = np.array(np.arange(24)).reshape((6,4))
dates_index = pd.date_range('20160101', periods=6)
sample_df = pd.DataFrame(sample_numpy_data, index=dates_index, columns=list('ABCD'))
sample_df
Explanation: Differences between interactive and production work
Note: while standard Python / Numpy expressions for selecting and setting are intuitive and come in handy for interactive work, for production code, we (the pandas development team) recommend the optimized pandas data access methods, .at, .iat, .loc, .iloc and .ix.
from:http://pandas.pydata.org/pandas-docs/stable/10min.html
End of explanation
sample_df['C']
Explanation: selection using column name
End of explanation
sample_df[1:4]
Explanation: selection using slice
remember: up to, but not including second index
End of explanation
sample_df['2016-01-01':'2016-01-04']
Explanation: selection using date time index
note: last index is included
End of explanation
sample_df.loc[dates_index[1:3]]
dates_index[2
           ]
Explanation: Selection by label
documentation: http://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.loc.html
label-location based indexer for selection by label
End of explanation
sample_df.loc[:,['A','B']]
Explanation: Selecting using multi-axis by label
End of explanation
sample_df.loc['2016-01-01':'2016-01-03',['A','B']]
Explanation: Label slicing, both endpoints are included
End of explanation
sample_df.loc['2016-01-03',['D','B']]
Explanation: Reduce number of dimensions for returned object
notice order of 'D' and 'B'
End of explanation
sample_df.loc['2016-01-03',['D','B']] [0] * 4
Explanation: using result
End of explanation
sample_df.loc[dates_index[2], 'C']
Explanation: select a scalar
End of explanation
sample_numpy_data[3]
sample_df.iloc[3]
Explanation: Selection by Position
documentation: http://pandas.pydata.org/pandas-docs/version/0.17.0/generated/pandas.DataFrame.iloc.html
integer-location based indexing for selection by position
End of explanation
sample_numpy_data[1:3, 2:4]
sample_df.iloc[1:3, 2:4]
Explanation: integer slices
End of explanation
sample_df.iloc[[0,1,3], [0,2]]
Explanation: lists of integers
End of explanation
sample_df.iloc[1:3,:]
Explanation: slicing rows explicitly
implicitly selecting all columns
End of explanation
sample_df.iloc[:, 1:3]
Explanation: slicing columns explicitly
implicitly selecting all rows
End of explanation
sample_df.C >= 14
sample_df[sample_df.A >= 14]
Explanation: Boolean Indexing
test based upon one column's data
End of explanation
sample_df[sample_df >= 11]
Explanation: test based upon entire data set
End of explanation
sample_df_2 = sample_df.copy()
sample_df_2['Fruits'] = ['apple', 'orange','banana','strawberry','blueberry','pineapple']
sample_df_2
Explanation: isin() method
documentation: http://pandas.pydata.org/pandas-docs/stable/generated/pandas.Series.isin.html
Returns a boolean Series showing whether each element in the Series is exactly contained in the passed sequence of values.
End of explanation
sample_df_2[sample_df_2['Fruits'].isin(['banana','pineapple', 'smoothy'])]
Explanation: select rows where 'Fruits' column contains eith 'banana' or 'pineapple'; notice 'smoothy', which is not in the column
End of explanation
<END_TASK>