<jupyter_start><jupyter_text>Ex3 - Getting and Knowing your Data This time we are going to pull data directly from the internet.Special thanks to: https://github.com/justmarkham for sharing the dataset and materials. Step 1. Import the necessary libraries<jupyter_code>!conda install --yes pandas
import pandas as pd<jupyter_output>Collecting package metadata (current_repodata.json): done
Solving environment: done


==> WARNING: A newer version of conda exists. <==
  current version: 4.7.12
  latest version: 4.8.0

Please update conda by running

    $ conda update -n base conda



# All requested packages already installed.<jupyter_text>Step 2. Import the dataset from this [address](https://raw.githubusercontent.com/justmarkham/DAT8/master/data/u.user).   Step 3. Assign it to a variable called users and use the 'user_id' as index<jupyter_code>data = pd.read_csv("https://raw.githubusercontent.com/justmarkham/DAT8/master/data/u.user", sep="|", index_col="user_id")<jupyter_output><empty_output><jupyter_text>Step 4. See the first 25 entries<jupyter_code>data.head(25)<jupyter_output><empty_output><jupyter_text>Step 5. See the last 10 entries<jupyter_code>data.tail(10)<jupyter_output><empty_output><jupyter_text>Step 6. What is the number of observations in the dataset?<jupyter_code>data.shape[0]<jupyter_output><empty_output><jupyter_text>Step 7. What is the number of columns in the dataset?<jupyter_code>data.shape[1]<jupyter_output><empty_output><jupyter_text>Step 8. Print the name of all the columns.<jupyter_code>for column in data.columns:
    print(column)<jupyter_output>age
gender
occupation
zip_code<jupyter_text>Step 9. How is the dataset indexed?<jupyter_code>data.index<jupyter_output><empty_output><jupyter_text>Step 10. What is the data type of each column?<jupyter_code>data.dtypes<jupyter_output><empty_output><jupyter_text>Step 11. Print only the occupation column<jupyter_code>data.occupation<jupyter_output><empty_output><jupyter_text>Step 12. How many different occupations there are in this dataset?<jupyter_code>data.occupation.nunique()<jupyter_output><empty_output><jupyter_text>Step 13. What is the most frequent occupation?<jupyter_code>data.occupation.value_counts().head(1).index[0]<jupyter_output><empty_output><jupyter_text>Step 14. Summarize the DataFrame.<jupyter_code>data.describe()<jupyter_output><empty_output><jupyter_text>Step 15. Summarize all the columns<jupyter_code>data.describe(include = "all")<jupyter_output><empty_output><jupyter_text>Step 16. Summarize only the occupation column<jupyter_code>data.occupation.describe()<jupyter_output><empty_output><jupyter_text>Step 17. What is the mean age of users?<jupyter_code>round(data.age.mean())<jupyter_output><empty_output><jupyter_text>Step 18. What is the age with least occurrence?<jupyter_code>data.age.value_counts().tail()<jupyter_output><empty_output>
StarcoderdataJupyterStructuredCleanDedup