<jupyter_start><jupyter_text>**Pandas - For Data Science / Machine Learning**
- Pandas is an open-source library.
- Pandas is used for data manipulation in ML.
- Easy to use data structures and data analysis tools for the Python programming language.<jupyter_code># import Pandas 
# if you are using your local box then install as follows
# write in your command prompt pip3 install pandas


import pandas as pd<jupyter_output><empty_output><jupyter_text>**It has 2 data stucture (for manipulation)**
 1. series
 2. Data Frame
  Panda Series :

we can think as column in a table<jupyter_code># crate a series

# create the pandas series object
series = pd.Series() 

# now print it

print(series)
print("\n ******************************************************* \n")

# what we can pass to the series object ?
# refer : https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.Series.html
# we can see we can pass an array, Iterable, dict, or scalar value

# lets create an array using numpy

# for that  we have to import another library which is numpy

import numpy as np

# arry = np.array()

# what to pass to the arry object ? 
# refer : https://numpy.org/doc/stable/reference/generated/numpy.array.html
# we can pass a list here

arry  = np.array(['a','b','c','d'])

#pass the array into the series
series = pd.Series(arry)

print(series)<jupyter_output><empty_output><jupyter_text>Pandas DataFrame
we can think as a table which has rows and columns<jupyter_code># creating a Data Frame

# create a string using list

strng = ["we","will","learn","pandas"]

# create a pandas data frame object and pass the above string(list)

# refer : https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.html

df = pd.DataFrame(strng)

df
# we can pass dict to pandas data frame
# lets create a dict

dct = {"Roll number" : [101,102,103,104,105,106] , "Student Names": ["ABCD" , "EFGH" ,"IJKL","MNOP","QRST","UVWX"]}

# create a data frame

df = pd.DataFrame(dct)

df<jupyter_output><empty_output><jupyter_text>There are number of way we can create Data frame
- Pandas Dataframe from list of list
- Pandas Dataframe from list using Zip
- Pandas Dataframe from list of dicts<jupyter_code># lets take the above example

# Pandas Dataframe from list of list
# create list of list (nested list)

lst_of_lst = [ [101,"ABCD"], [102,"EFGH"], [103,"IJKL"], [104,"MNOP"], [105,"QRST"], [106,"UVWX"] ]
print(lst_of_lst)

# create a data frame object

df = pd.DataFrame(lst_of_lst , columns=["Roll number" , "Student names"])

df
# Pandas Dataframe from list using Zip


roll_numb = [101,102,103,104,105,106]
student_names = ["ABCD" , "EFGH" ,"IJKL","MNOP","QRST","UVWX"]

# lets zip it

z = list(zip(roll_numb,student_names))
print(z)
print("----------------------------------------------------------------------------------------------------------")

# lets create a data frame object
df = pd.DataFrame(z , columns=["Roll number" , "Student names"])

df


#Pandas Dataframe from list of dicts
# lets create dicts and pass it on list

lst_of_dict = [  {"a":1 , "b":2 , "c":3,"d":4} ,  {"a":11,"b":12,"c":13,"d":14}  ]

print(lst_of_dict)

# create a pandas object and pass the above object

df = pd.DataFrame(lst_of_dict )

df<jupyter_output>[{'a': 1, 'b': 2, 'c': 3, 'd': 4}, {'a': 11, 'b': 12, 'c': 13, 'd': 14}]
{'fraction_non_alphanumeric': 0.17046117921774664, 'fraction_numerical': 0.023934617629889084, 'mean_word_length': 3.4622395833333335, 'pattern_counts': {'":': 9, '<': 16, '<?xml version=': 0, '>': 16, 'https://': 3, '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': '386410', 'license': 'MIT', 'n_tokens_mistral': 1269, 'n_tokens_neox': 1131, 'n_words': 377, 'path': 'Pandas_For_Data_Science_Machine_Learning_part_1_.ipynb', 'repo_name': 'Jitendra-Dash/Python-For-Data-Science', 'size': '3426'}