-
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
19eb48c
commit 1ceb70c
Showing
26 changed files
with
332 additions
and
41 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
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
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
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,10 +1,21 @@ | ||
from tkinter import * | ||
import tkinter.messagebox | ||
import tkinter.simpledialog | ||
root = Tk() | ||
|
||
tkinter.messagebox.showinfo('Window Title','This is the message') | ||
answer = tkinter.messagebox.askyesno('Question',"Are you sure to delete this record ?") | ||
if answer ==True : | ||
print("You selected to delete record") | ||
""" | ||
yesno = tkinter.messagebox.askyesno('Question',"Are you sure to delete this record ?") | ||
tkinter.messagebox.askokcancel() | ||
tkinter.messagebox.askquestion() | ||
tkinter.messagebox.askretrycancel() | ||
tkinter.messagebox.askyesnocancel() | ||
root.mainloop() | ||
if yesno ==True : | ||
print("You selected to delete record") | ||
""" | ||
|
||
no = tkinter.simpledialog.askstring('List Input','Enter number ') | ||
no = no.split() | ||
print(no) | ||
|
||
root.mainloop() |
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,3 @@ | ||
yesno = tkinter.messagebox.askyesno('Question',"Are you sure to delete this record ?") | ||
if yesno ==True : | ||
print("You selected to delete record") |
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
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,4 +1,4 @@ | ||
file = open(r"abcd.txt",'r') | ||
data1 = file.read() | ||
file = open("demo.txt") | ||
data1 = file.read() # | ||
print(data1) | ||
file.close() |
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
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,120 @@ | ||
import csv | ||
import re | ||
import xlwt | ||
|
||
|
||
def write2_cell(ws, row, roll, gender, name, marks): | ||
ws.write(row, 0, roll) | ||
ws.write(row, 1, name) | ||
ws.write(row, 2, gender) | ||
|
||
for values in marks.values(): | ||
if(values[0] == '301'): | ||
ws.write(row, 3, values[1]) | ||
if(values[0] == '302'): | ||
ws.write(row, 4, values[1]) | ||
if(values[0] == '041'): | ||
ws.write(row, 5, values[1]) | ||
if(values[0] == '042'): | ||
ws.write(row, 6, values[1]) | ||
if(values[0] == '043'): | ||
ws.write(row, 7, values[1]) | ||
if(values[0] == '283'): | ||
ws.write(row, 8, values[1]) | ||
if(values[0] == '265'): | ||
ws.write(row, 9, values[1]) | ||
if(values[0] == '044'): # biology | ||
ws.write(row, 10, values[1]) | ||
if(values[0] == '048'): # physical | ||
ws.write(row, 11, values[1]) | ||
if(values[0] == '030'): # economics | ||
ws.write(row, 12, values[1]) | ||
if(values[0] == '055'): # Accounts | ||
ws.write(row, 13, values[1]) | ||
if(values[0] == '054'): # BST | ||
ws.write(row, 14, values[1]) | ||
if(values[0] == '812'): # marketing | ||
ws.write(row, 15, values[1]) | ||
if(values[0] == '028'): # Pol science | ||
ws.write(row, 16, values[1]) | ||
if(values[0] == '034'): # music | ||
ws.write(row, 17, values[1]) | ||
if(values[0] == '049'): # music | ||
ws.write(row, 18, values[1]) | ||
|
||
|
||
file = open(r'C:\Users\rakesh\Desktop\z60074.txt', 'r') | ||
rows = csv.reader(file) | ||
wb = xlwt.Workbook() | ||
ws = wb.add_sheet("result") | ||
""" ws1 = wb.add_sheet("result1") """ | ||
|
||
st = xlwt.easyxf('font: bold yes;align: horiz centre , vert centre ,wrap yes') | ||
ws.write(0, 0, "Roll No", st) | ||
ws.write(0, 1, "Student Name", st) | ||
ws.write(0, 2, "Gender", st) | ||
ws.write(0, 3, "English", st) | ||
ws.write(0, 4, "Hindi", st) | ||
ws.write(0, 5, "Maths", st) | ||
ws.write(0, 6, "Physics", st) | ||
ws.write(0, 7, "Chemistry", st) | ||
ws.write(0, 8, "CS", st) | ||
ws.write(0, 9, "IP", st) | ||
ws.write(0, 10, "Bio", st) | ||
ws.write(0, 11, "Physical", st) | ||
ws.write(0, 12, "Eco", st) | ||
ws.write(0, 13, "Account", st) | ||
ws.write(0, 14, "Bst", st) | ||
ws.write(0, 15, "marketing", st) | ||
ws.write(0, 16, "Pol Sci", st) | ||
ws.write(0, 17, "Music", st) | ||
ws.write(0, 18, "ART", st) | ||
ws.write(0, 19, "result", st) | ||
|
||
n = 1 | ||
count = 0 | ||
for row in rows: | ||
if(len(row) <= 0): | ||
continue | ||
else: | ||
count += 1 | ||
line1 = ''.join(row) | ||
line2 = re.sub(' +', ' ', line1) | ||
line3 = line2.split(' ') | ||
if(count % 2 == 1): | ||
sub = {} | ||
roll = line3[0] | ||
gender = line3[1] | ||
name = line3[2] + " " + line3[3] | ||
number = False | ||
try: | ||
sub[1] = ['' . join(line3[4])] | ||
sub[2] = ['' . join(line3[5])] | ||
sub[3] = ['' . join(line3[6])] | ||
sub[4] = ['' . join(line3[7])] | ||
sub[5] = ['' . join(line3[8])] | ||
if(line3[9][0].isdigit()): | ||
sub[6] = ['' . join(line3[9])] | ||
number = True | ||
except: | ||
continue | ||
|
||
else: | ||
try: | ||
sub[1].append(line3[1]) | ||
sub[2].append(line3[3]) | ||
sub[3].append(line3[5]) | ||
sub[4].append(line3[7]) | ||
sub[5].append(line3[9]) | ||
if number: | ||
sub[6].append(line3[11]) | ||
except: | ||
print(roll, name, line3) | ||
continue | ||
|
||
if(count % 2 == 0): | ||
write2_cell(ws, n, roll, gender, name, sub) | ||
n = n+1 | ||
|
||
wb.save(r"C:\Users\rakesh\Desktop\result123.xls") | ||
print('File Generated.....Please check your file') |
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 +1 @@ | ||
print(x) | ||
print("Total lines that start with alphabet 'T' :",count) |
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,7 @@ | ||
import numpy as np | ||
a = np.array([1, 2, 3, 4, 5, 5, 6, 7, 8]) | ||
print(a[2]) | ||
print(a[0]) | ||
print(a[:3]) # slicing example | ||
print(a[2:6]) | ||
print(a[2::2]) |
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
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
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,17 @@ | ||
# 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) | ||
df = df.append({'admno': 9999, 'name': 'ramji', 'marks': 99, | ||
'fees': 9999.99}, ignore_index=True) | ||
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,12 +1,18 @@ | ||
# create dataframe using list of Python Dictionary | ||
# create dataframe using list of Tuple | ||
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} | ||
] | ||
) | ||
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) | ||
df = df.append({'admno': 9999, 'name': 'ramji', 'marks': 99, | ||
'fees': 9999.99,'grade':'a'}, ignore_index=True) | ||
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,20 @@ | ||
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) | ||
#df = df.drop('fees',axis=1) | ||
#df = df.drop(columns=['marks','fees']) | ||
#df = df.drop(['marks','fees'],axis=1) | ||
#df.drop('fees',axis=1,inplace=True) | ||
df =df.drop([1,2,3],axis=0) # delete rows | ||
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,20 @@ | ||
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), | ||
] | ||
data1 = [ | ||
|
||
(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) | ||
df1 = pd.DataFrame(data1, columns=heading) | ||
|
||
df2 = df.append(df1) # concatenation | ||
print(df2) |
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,14 @@ | ||
import pandas as pd | ||
|
||
right = pd.DataFrame({'admno': ['101', '102', '103', '104'], | ||
'Game': ['Cricket', 'BasketBall', 'Badminton', 'Swimming'], | ||
'Fee': [1200, 750, 800, 1500]}) | ||
print(right['Fee'].count()) | ||
print(right['Fee'].max()) | ||
print(right['Fee'].min()) | ||
print(right['Fee'].sum()) | ||
print(right['Fee'].mean()) #average | ||
print(right['Fee'].median()) #average | ||
print(right['Fee'].std()) #standard daviation | ||
print(right['Fee'].var()) #standard variance | ||
print(right['Fee'].quantile()) # quantile of the values |
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,18 @@ | ||
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) | ||
#df =df.rename(columns={"fees":'Annual Fees'}) | ||
#df = df.rename({'fees':'Yealy fees'},axis=1) | ||
df = df.rename({'fees':'yealy fees', 'marks':'ut-2'}, axis=1) | ||
#df.rename({'fees': 'yealy fees', 'marks': 'ut-2'}, axis=1,inplace=True) | ||
print(df) |
Oops, something went wrong.