How it works...

  1. Read in the movie dataset, and use the title of the movie to label each row. Use the get_dtype_counts method to output the number of columns with each specific data type:
>>> movie = pd.read_csv('data/movie.csv',
index_col='movie_title')
>>> movie.get_dtype_counts()
float64 13 int64 3 object 11 dtype: int64
  1. Use the select_dtypes method to select only the integer columns:
>>> movie.select_dtypes(include=['int']).head()
  1. If you would like to select all the numeric columns, you may simply pass the string number to the include parameter:
>>> movie.select_dtypes(include=['number']).head()
  1. An alternative method to select columns is with the filter method. This method is flexible and searches column names (or index labels) based on which parameter is used. Here, we use the like parameter to search for all column names that contain the exact string, facebook:
>>> movie.filter(like='facebook').head()
  1. The filter method allows columns to be searched through regular expressions with the regex parameter. Here, we search for all columns that have a digit somewhere in their name:
>>> movie.filter(regex='d').head()
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.129.72.176