<?php
//Definestudentdetai
$students=array(
Array(“rol
ls
lewhichcontainsstudentrol
lno,name,address,
ccourseintabularformatafteraccepti
ngcourseas
lno”=>1,“name”=>“JohnDoe”,“address”=>“123MainSt”,“col
lege”=>“ABC
College”,“course”=>“ComputerSci
ence”),
Array(“rol
lno”=>2,“name”=>“JaneSmith”,“address”=>“456MainSt”,“col
lege”=>“DEF
College”,“course”=>“InformationTechnology”),
Array(“rollno”=>3,“name”=>“BobJohnson”,“address”=>“789MainSt”,“college”=>“GHI
College”,“course”=>“BusinessAdministration”),
Array(“rollno”=>4,“name”=>“SarahLee”,“address”=>“101MainSt”,“college”=>“JKL
College”,“course”=>“Marketing”),
Array(“rollno”=>5,“name”=>“TomBrown”,“address”=>“121MainSt”,“college”=>“MNO
College”,“course”=>“ComputerScience”)
);
//CreateaSimpleXMLElementobject
$xml=newSimpleXMLElement(‘<students></students>’);
//AddstudentelementstotheXMLobject
Foreach($studentsas$student){
$student_element=$xml->addChild(‘student’);
$student_element->addChild(‘rollno’,$student[‘rollno’]);
$student_element->addChild(‘name’,$student[‘name’]);
$student_element->addChild(‘address’,$student[‘address’]);
$student_element->addChild(‘college’,$student[‘college’]);
$student_element->addChild(‘course’,$student[‘course’]);
}
//SavetheXMLdatatoafile
$xml->asXML(‘student.xml’);
//Getcourseinputfromuser
$course=isset($_POST[‘course’])?$_POST[‘course’]:‘’;
//LoadtheXMLfile
$xml=simplexml_load_file(‘student.xml’);
//Findstudentswithmatchingcourse
$fil
tered_students=$xml->xpath(“//student[
//Printtabl
eofmatchingstudents
Echo“<tableborder=’
1’>”;
Echo“<tr><th>Rol
course=’
$course’
]”);
l
No</th><th>Name</th><th>Address</th><th>Col
lege</th><th>Course</th></tr>”;
Foreach($fil
tered_studentsas$student){
Echo“<tr>”;
Echo“<td>{$student->rol
lno}</td>”;
Echo“<td>{$student->name}</td>”;
Echo“<td>{$student->address}</td>”;
Echo“<td>{$student->col
lege}</td>”;
Echo“<td>{$student->course}</td>”;
Echo“</tr>”;
}
Echo“</table>”;
?>
Importpandasaspd
#Readthedataset
Df=pd.read_csv(‘INvideos.csv’)
#Dropthecolumnsthatarenotrequired
Df=df.drop([‘video_id’,‘trending_date’,‘channel_title’,‘category_id’,‘publish_time’,‘tags’,
‘thumbnail_link’,‘comments_disabled’,‘ratings_disabled’,‘video_error_or_removed’],axis=1)
#Convertthedatatypeof‘views’,‘likes’,‘dislikes’,and‘comment_count’tointeger
Df[[‘views’,‘likes’,‘dislikes’,‘comment_count’]]=df[[‘views’,‘likes’,‘dislikes’,
‘comment_count’]].astype(int)
#Findthetotalviews,likes,dislikes,andcommentcount
Total_views=df[‘views’].sum()
Total_likes=df[‘likes’].sum()
Total_dislikes=df[‘dislikes’].sum()
Total_comments=df[‘comment_count’].sum()
Print(‘TotalViews:’,total_views)
Print(‘TotalLikes:’,total_likes)
Print(‘TotalDislikes:’,total_dislikes)
Print(‘TotalComments:’,total_comments)