This file contains hidden or 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
| data_json = pd.DataFrame(data_json, columns=['District', 'Grade', 'Year', 'Demographic', 'Number Tested', | |
| 'Mean Scale Score', 'Num Level 1', 'Pct Level 1', 'Num Level 2', | |
| 'Pct Level 2', 'Num Level 3', 'Pct Level 3', 'Num Level 4', | |
| 'Pct Level 4', 'Num Level 3 and 4', 'Pct Level 3 and 4']) |
This file contains hidden or 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
| data = [] | |
| for i in range(0, len(district)): | |
| record = [ | |
| district[i].get_text(), | |
| grade[i].get_text(), | |
| number_tested[i].get_text(), | |
| mean_scale_score[i].get_text() | |
| ] | |
| data.append(record) |
This file contains hidden or 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
| district = soup.find_all('district') | |
| grade = soup.find_all('grade') | |
| number_tested = soup.find_all('number_tested') | |
| mean_scale_score = soup.find_all('mean_scale_score') |
This file contains hidden or 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
| f = open('math results.xml') | |
| n = 20 | |
| for i in range(n): | |
| print(f.readline()) | |
| f.close() |
This file contains hidden or 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
| a_file = open("data/2006_-_2012__Math_Test_Results_-_District_-_All_Students.csv") | |
| n = 5 | |
| for i in range(n): | |
| line = a_file.readline() | |
| print(line) | |
| a_file.close() |
This file contains hidden or 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
| len(os.listdir('/tmp/train/')) | |
| #Results | |
| #25000 |
This file contains hidden or 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
| zip_ref = zipfile.ZipFile('train.zip', 'r') #Opens the zip file in read mode | |
| zip_ref.extractall('/tmp') #Extracts the files into the /tmp folder | |
| zip_ref.close() |
This file contains hidden or 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
| !kaggle competitions download -c dogs-vs-cats |
This file contains hidden or 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
| import zipfile | |
| import os | |
| os.environ['KAGGLE_CONFIG_DIR'] = "/content" | |
This file contains hidden or 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
| !cp '/content/drive/MyDrive/Kaggle/kaggle.json' '/content' |
NewerOlder