0% found this document useful (0 votes)
171 views11 pages

Periodic Project IP

1. The document discusses Pandas and its features for importing and analyzing CSV data files. 2. The code shows how to import Pandas and use various functions to read a CSV file on the periodic table and display subsets of the data in different ways. 3. The output displays the main menu and sample outputs of calling the functions, including displaying the full DataFrame, subsets of elements by block, and individual rows of data.

Uploaded by

evryanimation
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
171 views11 pages

Periodic Project IP

1. The document discusses Pandas and its features for importing and analyzing CSV data files. 2. The code shows how to import Pandas and use various functions to read a CSV file on the periodic table and display subsets of the data in different ways. 3. The output displays the main menu and sample outputs of calling the functions, including displaying the full DataFrame, subsets of elements by block, and individual rows of data.

Uploaded by

evryanimation
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Overview of Pandas

PANDAS:

Python is a general purpose, dynamic, high-level, and interpreted programming


language. It supports Object Oriented programming approach to develop applications.
It is the simple and easy to learn and provides lots of high level data structures. Guido
Van Rossum is known as the founder of Python programming.

Features of Python:

Python is a high level language. It is a free and open source language.

It is an interpreted language, as python programs are executed by an


interpreter.

Python is programs are easy to understand as they have a clearly defined


syntax and relatively simple structure.

Python case-sensitive. For example, NUMBER and number are not same in Python.

Python is portable and platform independent, means it can run on various operating
systems and hardware platforms.

Python has a rich library of predefined functions.

Python is also helpful in web development. Many popular web services and applications
are built using python.

Python uses indentation for blocks and nested blocks.

Installing Pandas
To Install pandas, type this command in cmd prompt:
pip install pandas

To import this library:


import pandas as pd
Introduction to Periodic Table

The periodic table is a tabular array of the chemical elements


organized by atomic number, from the element with the lowest
atomic number, hydrogen, to the element with the highest atomic
number, oganesson. The atomic number of an element is the number
of protons in the nucleus of an atom of that element.

The periodic table was invented by Russian chemist Dmitri


Mendeleev in 1869. However, prior to Mendeleev, chemists had been
pondering for decades how to classify the elements.

It's called the periodic table because of the way the elements are
arranged. The table is arranged into columns and rows. The vertical
columns are called 'groups' and the horizontal rows are called
'periods'.

In 1869, Russian chemist Dmitri Mendeleev created the framework


that became the modern periodic table, leaving gaps for elements
that were yet to be discovered. While arranging the elements
according to their atomic weight, if he found that they did not fit
into the group he would rearrange them.
Source Code
import pandas as pd

def showdata():
df=pd.read_csv("F:/IP/project/Periodic_Table.csv")
print(df)
input('Press any key to countinue......')

def dataNoIndex():
df=pd.read_csv("F:/IP/project/Periodic_Table.csv",index_col=0)
print(df)
input("Press any key to continue...")

def only_s():
df = pd.read_csv("F:/IP/project/Periodic_Table.csv",nrows=1)
print(df)
input("Press any key to continue...")

def only_f():
df = pd.read_csv("F:/IP/project/Periodic_Table.csv",nrows=2)
print(df)
input("Press any key to continue...")

def only_d():
df = pd.read_csv("F:/IP/project/Periodic_Table.csv",nrows=3)
print(df)
input("Press any key to continue...")
def only_p():
df = pd.read_csv("F:/IP/project/Periodic_Table.csv",nrows=4)
print(df)
input("Press any key to continue...")

def a1():
df = pd.read_csv("F:/IP/project/Periodic_Table2.csv")
data= df.iloc[0:1:]
print(data)

def a2():
df = pd.read_csv("F:/IP/project/Periodic_Table2.csv")
data= df.iloc[1:2:]
print(data)

def a3():
df = pd.read_csv("F:/IP/project/Periodic_Table2.csv")
data= df.iloc[2:3:]
print(data)

def a4():
df = pd.read_csv("F:/IP/project/Periodic_Table2.csv")
data= df.iloc[3:4:]
print(data)

def a5():
df = pd.read_csv("F:/IP/project/Periodic_Table2.csv")
data= df.iloc[4:5:]
print(data)

def a6():
df = pd.read_csv("F:/IP/project/Periodic_Table2.csv")
data= df.iloc[5:6:]
print(data)

def a7():
df = pd.read_csv("F:/IP/project/Periodic_Table2.csv")
data= df.iloc[6:7:]
print(data)
def a8():
df = pd.read_csv("F:/IP/project/Periodic_Table2.csv")
data= df.iloc[7:8:]
print(data)

def a9():
df = pd.read_csv("F:/IP/project/Periodic_Table2.csv")
data= df.iloc[8:9:]
print(data)

def main_menu():
print(" ==============================")
print(" Main Menu")
print(" ==============================")
ch=0
while ch!=7:
print("""
1. Show DataFrame
2. Data without index
3. Display only S-Block Elements
4. Display with F-Block Elements
5. Display with D-Block Elements
6. Display with P-Block Elements
--------------------------------
MORE
--------------------------------
7. Display Elements as ALkali Metals
8. Display Elements as Alkaline Metals
9. Display Elements as Transition Metals
10. Display Elements as Metalliods
11. Display Elements as Non-Metals
12. Display Elements as Halogen
13. Noble Gas
14. Lanthanoids
15. Actinoids
16. End
""")
ch=int(input("Enter your choice: "))
if ch==1:
showdata()
elif ch==2:
dataNoIndex()
elif ch==3:
only_s()
elif ch==4:
only_f()
elif ch==5:
only_d()
elif ch==6:
only_p()
elif ch==7:
a1()
elif ch==8:
a2()
elif ch==9:
a3()
elif ch==10:
a4()
elif ch==11:
a5()
elif ch==12:
a6()
elif ch==13:
a7()
elif ch==14:
a8()
elif ch==15:
a9()
elif ch==16:
print("Thank you, Bye Bye, See you again!!")
else:
print('Sorry Invalid Option!')
main_menu()
OutPut
1. The Main Menu

==============================
Main Menu
==============================

1. Show DataFrame
2. Data without index
3. Display only S-Block Elements
4. Display with F-Block Elements
5. Display with D-Block Elements
6. Display with P-Block Elements
--------------------------------
MORE
--------------------------------
7. Display Elements as Alkali Metals
8. Display Elements as Alkaline Metals
9. Display Elements as Transition Metals
10. Display Elements as Metalloids
11. Display Elements as Non-Metals
12. Display Elements as Halogen
13. Noble Gas
14. Lanthanoids
15. Actinoids
16. End
2. DataFrame

Enter your choice: 1


Unnamed: 0 0 1 2 3 4 5 ... 30 31 32 33 34 35 36
0 S-Block H He Li Na K Rb ... NaN NaN NaN NaN NaN NaN
NaN
1 F-Block La Ce Pr Nd Pm Sm ... Lw NaN NaN NaN NaN NaN
NaN
2 D-Block Sc Ti V Cr Mn Fe ... NaN NaN NaN NaN NaN NaN
NaN
3 P-Block B C N O F Ne ... Rn Nh Fl Mc Lv Ts Og

3. Data without Index

Enter your choice: 2


0 1 2 3 4 5 6 7 ... 29 30 31 32 33 34 35 36
S-Block H He Li Na K Rb Cs Fr ... NaN NaN NaN NaN NaN NaN
NaN NaN
F-Block La Ce Pr Nd Pm Sm Eu Gd ... No Lw NaN NaN NaN NaN
NaN NaN
D-Block Sc Ti V Cr Mn Fe Co Ni ... Hg NaN NaN NaN NaN NaN
NaN NaN
P-Block B C N O F Ne Al Si ... At Rn Nh Fl Mc Lv Ts Og

S-Block Elements

Unnamed: 0 0 1 2 3 4 5 6 7 ... 28 29 30 31 32 33 34 35 36
0 S-Block H He Li Na K Rb Cs Fr ... NaN NaN NaN NaN NaN NaN NaN
NaN NaN

5.F-Block Elements

Enter your choice: 4


Unnamed: 0 0 1 2 3 4 5 6 ... 29 30 31 32 33 34 35 36
0 S-Block H He Li Na K Rb Cs ... NaN NaN NaN NaN NaN NaN
NaN NaN
1 F-Block La Ce Pr Nd Pm Sm Eu ... No Lw NaN NaN NaN NaN NaN
NaN
6. D-Block Elements
Enter your choice: 5
Unnamed: 0 0 1 2 3 4 5 6 ... 29 30 31 32 33 34 35 36
0 S-Block H He Li Na K Rb Cs ... NaN NaN NaN NaN NaN NaN
NaN NaN
1 F-Block La Ce Pr Nd Pm Sm Eu ... No Lw NaN NaN NaN NaN NaN
NaN
2 D-Block Sc Ti V Cr Mn Fe Co ... Hg NaN NaN NaN NaN NaN NaN
NaN

7. P-Block Elements

Enter your choice: 6


Unnamed: 0 0 1 2 3 4 5 ... 30 31 32 33 34 35 36
0 S-Block H He Li Na K Rb ... NaN NaN NaN NaN NaN NaN
NaN
1 F-Block La Ce Pr Nd Pm Sm ... Lw NaN NaN NaN NaN NaN
NaN
2 D-Block Sc Ti V Cr Mn Fe ... NaN NaN NaN NaN NaN NaN
NaN
3 P-Block B C N O F Ne ... Rn Nh Fl Mc Lv Ts Og

8. Alkali Metals

Enter your choice: 7


Unnamed: 0 0 1 2 3 4 5 ... 23 24 25 26 27 28 29
0 Alkali Metals Li K Rb Cs Fr Na ... NaN NaN NaN NaN NaN NaN NaN

9. Alkaline Metals

Enter your choice: 8


Unnamed: 0 0 1 2 3 4 5 ... 23 24 25 26 27 28 29
1 Alkaline Metals Be Mg Ca Sr Ba Ra ... NaN NaN NaN NaN NaN NaN NaN
10. Transition Metals

Enter your choice: 9


Unnamed: 0 0 1 2 3 4 5 6 ... 22 23 24 25 26 27 28 29
2 Transition Metals Sc Ti V Cr Mn Fe Co ... Ta W Re Os Ir Pt Au Hg

11. Metalliods

Enter your choice: 10


Unnamed: 0 0 1 2 3 4 5 ... 23 24 25 26 27 28 29
3 Metalloids B Si Ge As Sb Tc ... NaN NaN NaN NaN NaN NaN
NaN

12. Non-Metals

Enter your choice: 11


Unnamed: 0 0 1 2 3 4 5 6 ... 22 23 24 25 26 27 28
29
4 Non-Metals H C N O P S Se ... NaN NaN NaN NaN NaN NaN
NaN NaN

13. Halogen

Enter your choice: 12


Unnamed: 0 0 1 2 3 4 5 ... 23 24 25 26 27 28 29
5 Halogen F Cl Br I At NaN ... NaN NaN NaN NaN NaN NaN NaN
14. Noble Gas

Enter your choice: 13


Unnamed: 0 0 1 2 3 4 5 ... 23 24 25 26 27 28 29
6 Noble Gases He Ne Ar Kr Xe Rn ... NaN NaN NaN NaN NaN NaN
NaN

15. Lanthanoids

Enter your choice: 14


Unnamed: 0 0 1 2 3 4 5 ... 23 24 25 26 27 28 29
7 Lanthanoids La Ce Pr Nd Pm Sm ... NaN NaN NaN NaN NaN NaN
NaN

16. Actinoids

Enter your choice: 15


Unnamed: 0 0 1 2 3 4 5 6 ... 22 23 24 25 26 27 28 29
8 Actinoids Ac Th Pa U Np Pu Am ... NaN NaN NaN NaN NaN NaN NaN NaN

17. Exit

Enter your choice: 16


Thank you, Bye Bye, See you again!!

You might also like