<jupyter_start><jupyter_text>Tutorial 5: Indexing-Selection-Filtering in Pandas Library<jupyter_code>import pandas as pd
import numpy as np
obj=pd.Series(np.arange(5),
              index=["a","b","c","d","e"])
obj
obj["c"]
obj[2]
obj[0:3]
obj[["a","c"]]
obj[[0,2]]
obj[obj<2]
obj["a":"c"]
obj["b":"c"]=5
obj<jupyter_output><empty_output><jupyter_text>DataFrame Indexing<jupyter_code>data=pd.DataFrame(
    np.arange(16).reshape(4,4),
    index=["London","Paris",
           "Berlin","Istanbul"],
    columns=["one","two","three","four"])
data
data["two"]
data[["one","two"]]
data[:3]
data[data["four"]>5]
data[data<5]=0
data<jupyter_output><empty_output><jupyter_text>Selecting with iloc and loc<jupyter_code>data.iloc[1]
data.iloc[1,[1,2,3]]
data.iloc[[1,3],[1,2,3]]
data.loc["Paris",["one","two"]]
data.loc[:"Paris","four"]
toy_data=pd.Series(np.arange(5),
                   index=["a","b","c",
                          "d","e"])
toy_data
toy_data[-1]<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.2383367139959432, 'fraction_numerical': 0.029411764705882353, 'mean_word_length': 5.714285714285714, 'pattern_counts': {'":': 2, '<': 15, '<?xml version=': 0, '>': 14, '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': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '262565', 'license': 'MIT', 'n_tokens_mistral': 428, 'n_tokens_neox': 416, 'n_words': 50, 'path': 'jupyter/pandas-tut/05-Indexing-Selecting-Filtering.ipynb', 'repo_name': 'Sesughter01/ds-march-univel', 'size': '986'}