<jupyter_start><jupyter_text><jupyter_code>import pandas as pd<jupyter_output><empty_output><jupyter_text>0. Introduction  DataFrameDataFrame is one of the basic data type in pandas. Basically it is table.<jupyter_code># you can create DataFrame from dictionary
pd.DataFrame({'Key1': [0, 1], 'Key2': [2, 3]})
# or from a lists
pd.DataFrame([[1,1,1,1], [2,2,2,2]], columns=['col1','col2','col3', 'col4'])
# as well as from numpy arrays
import numpy as np
a = np.arange(0,5)

pd.DataFrame([a,2*a, 3*a])<jupyter_output><empty_output><jupyter_text>Series<jupyter_code>pd.Series([1, 2, 3], dtype=float)<jupyter_output><empty_output><jupyter_text>1. Read data<jupyter_code>from google.colab import drive

# mount google drive
drive.mount('/content/drive')

# show directory content
!ls drive/My\ Drive/python_Mateusz/datasets
# read simple CSV

df = pd.read_csv("drive/My Drive/python_Mateusz/datasets/creditcard.csv")
df.shape
df.groupby(['Class']).median()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.15376782077393075, 'fraction_numerical': 0.0274949083503055, 'mean_word_length': 7.401709401709402, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, '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': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '76318', 'license': 'MIT', 'n_tokens_mistral': 387, 'n_tokens_neox': 376, 'n_words': 79, 'path': '3_Pandas.ipynb', 'repo_name': 'maskubica/python', 'size': '982'}