<jupyter_start><jupyter_text>Pandas  Introduction to Pandas<jupyter_code>import pandas as pd
data = pd.DataFrame({'Names': ['Sif', 'Daren', 'Bryan', 'Hector'],
                    'Dpt': ['Analytics', 'Media - SEM', 'Media - AFF', 'Analytics'],
                    'Years': [2, 2, 2, 1],
                    'Title': ['DS', 'MM', 'MM', 'Dr']})
# DataFrame function takes dictionary of keys and values to create a table
data
data.dtypes
data.describe()
data.columns
## .columns = argument
## .columns() = method
data.shape
import pandas as pd
# Read the data.
data = pd.read_csv('titanic.csv')
# Checking information about the data. DO THIS EVERYTIME
data.info()
# Rows and Columns
data.shape
# Size, Rows x Columns
data.size
# Summary Statistics
data.describe()
data.describe(include='all')
# Top 5
data.head()
# Bottom 10
data.tail(10)
data.dtypes
### Slicing and Dicing

data['Name'].head()
type(data['Name'])
type(data)
# List Manipulation 
[1,2,3,5] * 4
# Series Manipulation
data['Age'].head() * 4
# this is a vector - becomes a matrix once you add a column
data['Age'].head()
## Selecting Multiple ITems
data[ ['Name', 'Age']].head()
## Columns.

data.columns
## Drop columns 
print(data.columns)

#2 arguments, inplace=True 
data.drop(['PassengerId', 'Parch'], axis=1, inplace=True)

#
print(data.columns)
## Drop columns 
print(data.columns)

#2 arguments, inplace=True 
data.drop(['Age'], axis=1)

#
print(data.columns)
data.head()
## Above didn't delete Age because did not use inplace
## The Age attribute still exists but the data does not truly delete
## Drop columns 
print(data.columns)

#2 arguments, inplace=True 
data.drop(['Age'], axis=1, inplace=True)

#
print(data.columns)
data.head()
## ^Data above is missing Age, PassengerId and Parch
data[:5]<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.15628476084538376, 'fraction_numerical': 0.012235817575083427, 'mean_word_length': 4.370149253731343, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '340382', 'license': 'Apache-2.0', 'n_tokens_mistral': 637, 'n_tokens_neox': 608, 'n_words': 186, 'path': 'Fundamentals/Class_Notes/Pandas_1.0.ipynb', 'repo_name': 'bnonni/Python', 'size': '1798'}