Skip to content

Commit

Permalink
tutorial98
Browse files Browse the repository at this point in the history
  • Loading branch information
ronidas39 committed Jun 29, 2024
1 parent ecaef54 commit 7b8fcda
Show file tree
Hide file tree
Showing 8 changed files with 828 additions and 0 deletions.
Binary file added tutorial98/cache/cache_db_0.10.db
Binary file not shown.
1 change: 1 addition & 0 deletions tutorial98/columns.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
PlayerName,Duration_in_years,MatchPlayed,Number_of_Innings,NotOut_Count,TotalRuns,HighestScore,Average,Number_of_Balls_Fcaed,Strike_Rate,1OO's_count,50's Count,zero count,fours count,sixers count
32 changes: 32 additions & 0 deletions tutorial98/load.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
from langchain_community.document_loaders import AsyncChromiumLoader
from bs4 import BeautifulSoup
import io

urls=["https://www.espncricinfo.com/records/most-runs-in-career-223646"]
loader=AsyncChromiumLoader(urls)
html=loader.load()
data=[]
soup=BeautifulSoup(html[0].page_content,"html.parser")
try:
HTML_DATA=soup.find_all("tbody")[0].find_all("tr")[:]
for element in HTML_DATA:
sub_data=[]
for sub_element in element:
try:
if sub_element.get_text() != "\n":
datalines=sub_element.get_text().replace("+","")
sub_data.append(datalines)
except:
continue
data.append(sub_data)
with io.open("output.csv","w",encoding="utf-8")as f1:
f1.write("PlayerName,Duration_in_years,MatchPlayed,Number_of_Innings,NotOut_Count,TotalRuns,HighestScore,Average,Number_of_Balls_Fcaed,Strike_Rate,1OO's_count,50's Count,zero count,fours count,sixers count"+"\n")
for rows in data:
row=",".join(rows)
f1.write(row+"\n")
f1.close()

except Exception as e:
print(str(e))


9 changes: 9 additions & 0 deletions tutorial98/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import pandas as pd
from pandasai import SmartDataframe
from langchain_openai import ChatOpenAI
llm=ChatOpenAI(model="gpt-4o")

df=pd.read_csv(r"C:\Users\welcome\OneDrive\Documents\GitHub\LLMtutorial\tutorial98\output.csv")
sdf=SmartDataframe(df,config={"llm":llm})
response=sdf.chat("who played longest duration in years?")
print(response)
108 changes: 108 additions & 0 deletions tutorial98/output.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
PlayerName,Duration_in_years,MatchPlayed,Number_of_Innings,NotOut_Count,TotalRuns,HighestScore,Average,Number_of_Balls_Fcaed,Strike_Rate,1OO's_count,50's Count,zero count,fours count,sixers count
SR Tendulkar (IND),1989-2013,200,329,33,15921,248*,53.78,29437,54.04,51,68,14,2058,69
RT Ponting (AUS),1995-2012,168,287,29,13378,257,51.85,22782,58.72,41,62,17,1509,73
JH Kallis (ICC/SA),1995-2013,166,280,40,13289,224,55.37,28903,45.97,45,58,16,1488,97
R Dravid (ICC/IND),1996-2012,164,286,32,13288,270,52.31,31258,42.51,36,63,8,1654,21
AN Cook (ENG),2006-2018,161,291,16,12472,294,45.35,26562,46.95,33,57,9,1442,11
KC Sangakkara (SL),2000-2015,134,233,17,12400,319,57.40,22882,54.19,38,52,11,1491,51
BC Lara (ICC/WI),1990-2006,131,232,6,11953,400*,52.88,19753,60.51,34,48,17,1559,88
S Chanderpaul (WI),1994-2015,164,280,49,11867,203*,51.37,27395,43.31,30,66,15,1285,36
DPMD Jayawardene (SL),1997-2014,149,252,15,11814,374,49.84,22959,51.45,34,50,15,1387,61
JE Root (ENG),2012-2024,140,257,21,11736,254,49.72,20762,56.52,31,61,12,1280,44
AR Border (AUS),1978-1994,156,265,44,11174,205,50.56,27002,41.09,27,63,11,1161,28
SR Waugh (AUS),1985-2004,168,260,46,10927,200,51.06,22461,48.64,32,50,22,1175,20
SM Gavaskar (IND),1971-1987,125,214,16,10122,236*,51.12,14184,43.35,34,45,12,908,26
Younis Khan (PAK),2000-2017,118,213,19,10099,313,52.05,19375,52.12,34,33,19,1082,70
SPD Smith (AUS),2010-2024,109,195,25,9685,239,56.97,18100,53.50,32,41,10,1063,54
HM Amla (SA),2004-2019,124,215,16,9282,311*,46.64,18573,49.97,28,41,13,1170,14
GC Smith (ICC/SA),2002-2014,117,205,13,9265,277,48.25,15525,59.67,27,38,11,1165,24
GA Gooch (ENG),1975-1995,118,215,6,8900,333,42.58,18075,49.23,20,46,13,1079,25
V Kohli (IND),2011-2024,113,191,11,8848,254*,49.15,15924,55.56,29,30,14,991,26
Javed Miandad (PAK),1976-1993,124,189,21,8832,280*,52.57,15164,45.99,23,43,6,788,48
Inzamam-ul-Haq (ICC/PAK),1992-2007,120,200,22,8830,329,49.60,16345,54.02,25,46,15,1105,48
DA Warner (AUS),2011-2024,112,205,8,8786,335*,44.59,12517,70.19,26,37,13,1036,69
VVS Laxman (IND),1996-2012,134,225,34,8781,281,45.97,17785,49.37,17,56,14,1135,5
AB de Villiers (SA),2004-2018,114,191,18,8765,278*,50.66,16077,54.51,22,46,8,1024,64
KS Williamson (NZ),2010-2024,100,176,17,8743,251,54.98,17006,51.41,32,34,11,971,24
MJ Clarke (AUS),2004-2015,115,198,22,8643,329*,49.10,15456,55.92,28,27,9,978,39
ML Hayden (AUS),1994-2009,103,184,14,8625,380,50.73,14349,60.10,30,29,14,1049,82
V Sehwag (ICC/IND),2001-2013,104,180,6,8586,319,49.34,10441,82.23,23,32,16,1233,91
IVA Richards (WI),1974-1991,121,182,12,8540,291,50.23,9613,69.77,24,45,10,952,84
AJ Stewart (ENG),1990-2003,133,235,21,8463,190,39.54,17389,48.66,15,45,14,1121,10
DI Gower (ENG),1978-1992,117,204,18,8231,215,44.25,16268,50.59,18,39,7,979,10
KP Pietersen (ENG),2005-2014,104,181,8,8181,227,47.28,13255,61.72,23,35,10,985,81
G Boycott (ENG),1964-1982,108,193,23,8114,246*,47.72,20528,35.69,22,42,10,765,8
GS Sobers (WI),1954-1974,93,160,21,8032,365*,57.78,4063,53.58,26,30,12,593,32
ME Waugh (AUS),1991-2002,128,209,17,8029,153*,41.81,15360,52.27,20,47,19,844,41
MA Atherton (ENG),1989-2001,115,212,7,7728,185*,37.69,20609,37.49,16,46,20,904,4
IR Bell (ENG),2004-2015,118,205,24,7727,235,42.69,15622,49.46,22,46,14,919,39
JL Langer (AUS),1993-2007,105,182,12,7696,250,45.27,14192,54.22,23,30,11,912,40
LRPL Taylor (NZ),2007-2022,112,196,24,7683,290,44.66,12957,59.29,19,35,14,932,55
MC Cowdrey (ENG),1954-1975,114,188,15,7624,182,44.06,6272,37.45,22,38,9,708,13
AD Mathews (SL),2009-2024,109,193,26,7608,200*,45.55,15638,48.65,16,41,5,782,86
CG Greenidge (WI),1974-1991,108,185,16,7558,226,44.72,11932,49.49,19,34,11,872,67
Mohammad Yousuf (PAK),1998-2010,90,156,12,7530,223,52.29,14372,52.39,24,33,11,957,51
MA Taylor (AUS),1989-1999,104,186,13,7525,334*,43.49,18140,41.48,19,40,5,727,9
CH Lloyd (WI),1966-1985,110,175,14,7515,242*,46.67,6942,56.68,19,39,4,712,70
DL Haynes (WI),1978-1994,116,202,25,7487,184,42.29,15052,44.41,18,39,10,818,24
DC Boon (AUS),1984-1996,107,190,20,7422,200,43.65,18116,40.96,21,32,16,822,2
G Kirsten (SA),1993-2004,101,176,15,7289,275,45.27,16783,43.43,21,34,13,922,12
WR Hammond (ENG),1927-1947,85,140,16,7249,336*,58.45,7491,38.07,22,24,4,419,27
CH Gayle (WI),2000-2014,103,182,11,7214,333,42.18,11970,60.26,15,37,15,1046,98
SC Ganguly (IND),1996-2008,113,188,17,7212,239,42.17,14070,51.25,16,35,13,900,57
CA Pujara (IND),2010-2023,103,176,11,7195,206*,43.60,16217,44.36,19,35,12,863,16
SP Fleming (NZ),1994-2008,111,189,10,7172,274*,40.06,15652,45.82,9,46,16,917,26
Azhar Ali (PAK),2010-2022,97,180,11,7142,302*,42.26,17033,41.93,19,35,19,694,22
GS Chappell (AUS),1970-1984,87,151,19,7110,247*,53.86,13079,51.53,24,31,12,755,16
AJ Strauss (ENG),2004-2012,100,178,6,7037,177,40.91,14385,48.91,21,27,15,867,10
DG Bradman (AUS),1928-1948,52,80,10,6996,334,99.94,9800,58.60,29,13,7,626,6
ST Jayasuriya (SL),1991-2007,110,188,14,6973,340,40.07,10698,65.18,14,31,15,910,59
L Hutton (ENG),1937-1955,79,138,15,6971,364,56.67,2844,39.34,19,33,5,358,7
FDM Karunaratne (SL),2012-2024,91,174,7,6899,244,41.31,13337,51.72,16,37,12,730,12
DB Vengsarkar (IND),1976-1992,116,185,22,6868,166,42.13,10810,41.56,17,35,15,509,17
KF Barrington (ENG),1955-1968,82,131,15,6806,256,58.67,4957,42.42,20,35,5,591,27
GP Thorpe (ENG),1993-2005,100,179,28,6744,200*,44.66,14693,45.89,16,39,12,778,9
BB McCullum (NZ),2004-2016,101,176,9,6453,302,38.64,9989,64.60,12,31,14,776,107
PA de Silva (SL),1984-2002,93,159,11,6361,267,42.97,11249,51.04,20,22,7,737,48
BA Stokes (ENG),2013-2024,102,185,7,6316,258,35.48,10702,59.01,13,31,15,735,128
MEK Hussey (AUS),2005-2013,79,137,16,6235,195,51.52,12436,50.13,19,29,12,685,39
RB Kanhai (WI),1957-1974,79,137,6,6227,256,47.53,2914,47.87,15,28,7,491,23
M Azharuddin (IND),1984-2000,99,147,9,6215,199,45.03,9892,57.82,22,21,5,720,19
HH Gibbs (SA),1996-2008,90,154,7,6167,228,41.95,12270,50.26,14,26,11,887,47
RN Harvey (AUS),1948-1963,79,137,10,6149,205,48.41,1799,43.74,21,24,7,427,1
GR Viswanath (IND),1969-1983,91,155,10,6080,222,41.93,7573,43.62,14,35,10,567,6
JM Bairstow (ENG),2012-2024,100,178,12,6042,167*,36.39,10228,59.07,12,26,17,719,56
RB Richardson (WI),1983-1995,86,146,12,5949,194,44.39,12398,47.77,16,27,8,761,23
RR Sarwan (WI),2000-2011,87,154,8,5842,291,40.01,12484,46.79,15,31,12,747,14
ME Trescothick (ENG),2000-2006,76,143,10,5825,219,43.79,10685,54.51,14,29,12,831,42
DCS Compton (ENG),1937-1957,78,131,15,5807,278,50.06,2731,38.81,17,28,10,342,3
Saleem Malik (PAK),1982-1999,103,154,22,5768,237,43.69,10906,49.33,15,29,12,678,7
N Hussain (ENG),1990-2004,96,171,16,5764,207,37.18,14272,40.38,14,33,14,734,24
CL Hooper (WI),1987-2002,102,173,15,5762,233,36.46,11462,50.27,13,27,13,633,63
MP Vaughan (ENG),1999-2008,82,147,9,5719,197,41.44,11184,51.13,18,18,9,742,22
Mushfiqur Rahim (BAN),2005-2023,88,163,14,5676,219*,38.09,11808,48.06,10,27,12,673,34
AC Gilchrist (AUS),1999-2008,96,137,20,5570,204*,47.60,6796,81.95,17,26,14,677,100
MV Boucher (ICC/SA),1997-2012,147,206,24,5515,125,30.30,11005,50.11,5,35,17,656,20
KC Brathwaite (WI),2011-2024,89,171,10,5513,212,34.24,13649,40.39,12,29,16,550,13
MS Atapattu (SL),1990-2007,90,156,15,5502,249,39.02,12384,44.42,16,17,22,685,4
TM Dilshan (SL),1999-2013,87,145,11,5492,193,40.98,8379,65.54,16,23,14,677,24
LD Chandimal (SL),2011-2024,79,142,15,5479,206*,43.14,10977,49.91,15,26,6,566,42
TT Samaraweera (SL),2001-2013,81,132,20,5462,231,48.76,11641,46.92,14,30,11,633,7
UT Khawaja (AUS),2011-2024,73,131,12,5451,195*,45.80,11288,48.29,15,26,8,592,26
MD Crowe (NZ),1982-1995,77,131,11,5444,299,45.36,12190,44.65,17,18,9,659,27
TWM Latham (NZ),2014-2024,80,142,6,5418,264*,39.83,11541,46.94,13,28,11,617,19
JB Hobbs (ENG),1908-1930,61,102,7,5410,211,56.94,5363,46.22,15,28,4,276,8
KD Walters (AUS),1965-1981,74,125,14,5357,250,48.26,8662,49.16,15,33,4,525,23
D Elgar (SA),2012-2024,86,152,11,5347,199,37.92,11190,47.78,14,23,13,684,26
IM Chappell (AUS),1964-1980,75,136,10,5345,196,42.42,8511,45.64,14,26,11,562,15
JG Wright (NZ),1978-1993,82,148,7,5334,185,37.82,14619,35.26,12,23,7,621,10
MJ Slater (AUS),1993-2001,74,131,7,5312,219,42.83,9967,53.29,14,21,9,598,30
N Kapil Dev (IND),1978-1994,131,184,15,5248,163,31.05,5192,79.33,8,27,16,557,61
WM Lawry (AUS),1961-1971,67,123,12,5234,210,47.15,7154,39.34,13,27,6,433,15
Misbah-ul-Haq (PAK),2001-2017,75,132,20,5222,161*,46.62,11726,44.53,10,39,9,511,81
IT Botham (ENG),1977-1992,102,161,6,5200,208,33.54,8565,60.71,14,22,14,621,67
JH Edrich (ENG),1963-1976,77,127,9,5138,310*,43.54,12102,37.23,12,24,6,548,11
Tamim Iqbal (BAN),2008-2023,70,134,2,5134,206,38.89,8852,57.99,10,31,11,655,41
A Ranatunga (SL),1982-2000,93,155,12,5105,135*,35.69,8672,49.96,4,38,12,534,40
AM Rahane (IND),2013-2023,85,144,12,5077,188,38.46,10256,49.50,12,26,10,578,35
Zaheer Abbas (PAK),1969-1985,78,124,11,5062,274,44.79,6935,55.22,12,20,10,458,22
Loading

0 comments on commit 7b8fcda

Please sign in to comment.