-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
da25a2a
commit 19eb48c
Showing
8 changed files
with
79 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# create dataframe using list of Tuple | ||
import pandas as pd | ||
data = [ | ||
(1101, 'rakesh', 56, 5656.56), | ||
(1203, 'jatin jain', 56, 5666.56), | ||
(1205, 'pushkar', 78, 5666.56), | ||
(1206, 'arushi', 98, 4564.34), | ||
(1208, 'mannat bhatia', 89, 4500), | ||
(1234, 'unnati', 67, 3500.56), | ||
(1245, 'Nikunj Tyagi', 68, 4500), | ||
(5755, 'vishank', 89, 5000) | ||
] | ||
heading = ["admno", "name", "marks", "fees"] | ||
df = pd.DataFrame(data, columns=heading) | ||
print(df[['name','fees']] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# create dataframe using list of Tuple | ||
import pandas as pd | ||
data = [ | ||
(1101, 'rakesh', 56, 5656.56), | ||
(1203, 'jatin jain', 56, 5666.56), | ||
(1205, 'pushkar', 78, 5666.56), | ||
(1206, 'arushi', 98, 4564.34), | ||
(1208, 'mannat bhatia', 89, 4500), | ||
(1234, 'unnati', 67, 3500.56), | ||
(1245, 'Nikunj Tyagi', 68, 4500), | ||
(5755, 'vishank', 89, 5000) | ||
] | ||
heading = ["admno", "name", "marks", "fees"] | ||
df = pd.DataFrame(data, columns=heading) | ||
print(df[1]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# create dataframe using Python Dictionary | ||
import pandas as pd | ||
df= pd.DataFrame( | ||
{ | ||
'admno' :[10,12,45,56,78,88], | ||
'name' :['rakesh','tarun','nikunj','arushi','pushkar','jatin'], | ||
'marks' :[56,67,78,99,67,56], | ||
'fees' :[345.67,676.45,677,456,7687,5656] | ||
} | ||
) | ||
print(df) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# create dataframe using list of Python Dictionary | ||
import pandas as pd | ||
df = pd.DataFrame( | ||
[ | ||
{'admno': 1101,'name': 'rakesh','marks' :56, 'fees': 5656.56}, | ||
{'admno': 1203, 'name':'jatin jain','marks':56, 'fees': 5666.56}, | ||
{'admno': 1205, 'name':'pushkar','marks':78, 'fees': 5666.56}, | ||
{'admno': 1206, 'name':'arushi','marks':98, 'fees': 4564.34}, | ||
{'admno': 1208, 'name':'mannat bhatia','marks':89, 'fees': 4500} | ||
] | ||
) | ||
print(df) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# create pandas dataframe using csv file | ||
import pandas as pd | ||
df = pd.read_csv('student.csv') | ||
print(df) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# create python pandas using Excel file | ||
import pandas as pd | ||
df = pd.read_excel("result.xls","result") | ||
print(df) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# create dataframe using list of Tuple | ||
import pandas as pd | ||
data = [ | ||
(1101, 'rakesh', 56,5656.56), | ||
(1203, 'jatin jain',56, 5666.56), | ||
(1205,'pushkar',78,5666.56), | ||
(1206,'arushi', 98, 4564.34), | ||
(1208,'mannat bhatia', 89, 4500), | ||
(1234,'unnati',67,3500.56), | ||
(1245,'Nikunj Tyagi',68,4500), | ||
(5755,'vishank',89,5000) | ||
] | ||
heading = ["admno","name","marks","fees"] | ||
df = pd.DataFrame(data,columns=heading) | ||
print(df) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,4 @@ | ||
# retirve values from pandas series using head() and tail() function | ||
|
||
# create python pandas using Excel file | ||
import pandas as pd | ||
s= pd.Series(range(1,1000,5)) | ||
#print top 5 entries of the series | ||
print(s.head()) | ||
#print top 2 entries of the series | ||
print(s.head(2)) | ||
|
||
#print last 5 entries of the series | ||
print(s.tail()) | ||
# print last 2 entries of the series | ||
print(s.tail(2)) | ||
df = pd.read_excel("result.xls","result") | ||
print(df) |