<jupyter_start><jupyter_text>DSPT3 Warm Up  All questions in this code challenge refer to the dataframe below.                                                                                 .<jupyter_code>import pandas as pd
df = pd.read_csv('https://raw.githubusercontent.com/ValerieLangat/CC-DSPT3/master/Cars%20-%20Sheet1.csv')<jupyter_output><empty_output><jupyter_text>Question 1: Find the max and min values of the passengers column *without* using df.describe()<jupyter_code>df.head(1)
df['Passengers'].max()
df['Passengers'].min()<jupyter_output><empty_output><jupyter_text>.  Question 2: Using the same dataset, create both a crosstab and a pivot table. When might one be better to use than the other?<jupyter_code>#Crosstab of Passengers vs Manufacturer

price = pd.crosstab(df['Passengers'], df['Manufacturer'])
price
# Pivot table
df.pivot_table('Price', index='Passengers', columns='Cylinders')
# Just another pivot table
df.pivot_table('Price', index='MPG.city', columns='MPG.highway')
# In general, use a pivot_table if you already have a DataFrame so you don't have the additional overhead of creating the same DataFrame again.
#      If you're starting from an array-like objects and are only concerened with pivoted data, use crosstab. 
#      The pivot table does not have the normalize argument, so if you want to normalize data, use crosstab

# Crosstabs let you quickly compare, contrast and otherwise asses info based on the variables you choose. If you wanted to do a more deeper analysis, you would need to go back to the beginning and generate
#     new reports with new variables to show the new data you want to view. With pivot tables, you can do those actiosn right on the table itself.

# While pivot tables may display the same data as crosstabls, pivot tables let you drag, drop and rearrange data to create additional reports right on the spot

# A single pivot table provides the foundation for any number of different ways of lookingt at the available data, all by simply manipulationg the table as desired. White some crosstab software may provide
#     advandced features in crosstab reports, pivot tables still tend to come packed with greater number capabilities.<jupyter_output><empty_output><jupyter_text>.  Question 3:  Let's practice some filtering. In our main dataframe, which manufacturer, model and type of car has the highest reported Price? (hint: checkout df.loc) What is the exact row and column number of the cell containing the highest reported Price? Please print that value.<jupyter_code>import numpy as np
df.groupby('Price').aggregate({'Manufacturer': 'max', 'Model': 'max', 'Type':'max'}, ascending=True)
def filter_func(x):
  return x['Price'].max()

he = ('df', "df.groupby('Manufacturer').max()", "df.groupby('Model').max()", "df.grouby('Type').max()")
he
df.max()

df.loc[lambda df: df['Price'] == [df['Price'].max()]]<jupyter_output><empty_output><jupyter_text>.  Question 4:  Get creative! Use any library you'd like to practice making plots. If you have extra time, try to incorporate color or something cool you've found that we haven't reviewed in class yet. Have fun with this and let's get some volunteers to show off their creations :)<jupyter_code>import seaborn as sns

sns.catplot(x='MPG.city', y='Price', col='Manufacturer', kind='bar', data=df, height=2)

sns.barplot(df['Price'], df['Manufacturer'], color='r',)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.0962269669494004, 'fraction_numerical': 0.0038022813688212928, 'mean_word_length': 4.786802030456853, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 3, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '231448', 'license': 'MIT', 'n_tokens_mistral': 1007, 'n_tokens_neox': 955, 'n_words': 407, 'path': 'TD_DSPT3_WarmUp_9_17_2019.ipynb', 'repo_name': 'cardstud/DS-Unit-1-Sprint-2-Data-Wrangling-and-Storytelling', 'size': '3419'}