# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3.8.1 64-bit
#     name: python38164bit3bfc73e8a84a4efc8a32e3d16f747847
# ---

# + tags=[]
import camelot 
import re
import pandas as pd
tables = camelot.read_pdf('result.pdf', pages="17")
marks = tables[0].df.iloc[[3,6,9,12,15,18,21,24,27,30],3:12]
# print(marks.to_string(index=False, header=False))
new = marks.to_string
marks.to_csv('file.csv', index=False, header=False)

f = open('file.csv')
text = f.read()
f.close()
result = re.sub("[\(\[].*?[\)\]]", " ", text)
result2 = re.sub(".,", " ", result)

with open("file.csv", "w") as outfile: 
    outfile.write(result2) 
print(result2)
df = pd.read_csv("file.csv") 
df
# -

import camelot 
import pandas as pd
tables = camelot.read_pdf('result.pdf', pages="17")
tables[0].df


# + tags=[]
import camelot 
import re
import pandas as pd
tables = camelot.read_pdf('result.pdf', pages="17")
marks = tables[0].df.iloc[[3,6,9,12,15,18,21,24,27,30],3:12]
print(marks)
marks.to_csv('sample.csv')
df = pd.read_csv("sample.csv") 


# + tags=[]
import camelot 
import re
import pandas as pd
tables = camelot.read_pdf('result.pdf', pages="17")
marks = tables[0].df.iloc[[3,6,9,12,15,18,21,24,27,30],2:13]
df = marks.replace('\D+', '', regex=True).apply(pd.to_numeric, errors='coerce')
# name search
name = tables[0].df.iloc[25,2]
nameonly = re.findall("(.*\n){2}", name)
str1 = ''.join(nameonly)
nameonly1 = re.sub("\n", "", str1)
print(nameonly1)
# print(df)
df['Total'] = df.sum(axis=1)
# print(df)
print(df.iloc[8,11]/10)


StarcoderdataJupyterScriptsDedupFiltered