Google Colaboratory Basics
මේකෙන් තමයි අනිත් සියල්ල ධාවනය කරන්නේ — ML කේත ලියන්න කලින්, cells run කරන්නෙ කොහොමද, වැඩේ නැති වෙන්නෙ නැතුව save කරන්නෙ කොහොමද කියලා දැනගන්න ඕන.
This is the notebook you'll run everything else in — so before touching any ML code, you need to know how to move around it, run cells, and not lose your work.
Lesson 1 of 64 · Part 1 · Python & Data Basics · Python Fundamentals · bilingual notes (English + සිංහල)
Why this matters. This is the notebook you'll run everything else in — so before touching any ML code, you need to know how to move around it, run cells, and not lose your work.
සිංහලෙන්: මේකෙන් තමයි අනිත් සියල්ල ධාවනය කරන්නේ — ML කේත ලියන්න කලින්, cells run කරන්නෙ කොහොමද, වැඩේ නැති වෙන්නෙ නැතුව save කරන්නෙ කොහොමද කියලා දැනගන්න ඕන.
What you'll use this for. Every single lesson after this one assumes you already know these basics — skip this and small things (a stuck cell, a lost file) will slow you down for weeks.
සිංහලෙන්: මින් පස්සේ තියෙන හැම පාඩමකම, ඔයා මේ මූලික දේවල් දන්නවා කියලා හිතාගෙනයි කරන්නෙ — මේක මගහැරියොත් පොඩි දේවල් (cell එකක් නවතිනවා, ගොනුවක් නැති වෙනවා) සති ගණනක් වේලාව නාස්ති කරයි.
Key principles
- Cells run in order, not by position. A cell only knows about variables from cells that have already been run — scroll order on screen doesn't matter, run order does.
Cells ධාවනය වෙන්නෙ පිළිවෙලට, තියෙන තැනට නෙවෙයි - Save to Drive, not just your browser. Colab keeps a copy in your Google Drive. Closing the tab is safe; losing your Google account access is not.
Drive එකට save කරන්න, browser එකට විතරක් නෙවෙයි
Walkthrough
System Specifications
!cat /proc/cpuinfoOutput
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 63
model name : Intel(R) Xeon(R) CPU @ 2.30GHz
stepping : 0
microcode : 0x1
cpu MHz : 2299.998
cache size : 46080 KB
physical id : 0
siblings : 2
core id : 0
cpu cores : 1
apicid : 0
initial apicid : 0
fpu : yes
fpu_exception : yes
cpuid level : 13
… (35 more lines)!cat /proc/meminfoOutput
MemTotal: 13305332 kB
MemFree: 10739068 kB
MemAvailable: 12518448 kB
Buffers: 83580 kB
Cached: 1841060 kB
SwapCached: 0 kB
Active: 984448 kB
Inactive: 1350192 kB
Active(anon): 382636 kB
Inactive(anon): 416 kB
Active(file): 601812 kB
Inactive(file): 1349776 kB
Unevictable: 0 kB
Mlocked: 0 kB
SwapTotal: 0 kB
SwapFree: 0 kB
Dirty: 760 kB
Writeback: 0 kB
… (32 more lines)Installing Libraries
!pip install pandasOutput
Requirement already satisfied: pandas in /usr/local/lib/python3.7/dist-packages (1.1.5)
Requirement already satisfied: pytz>=2017.2 in /usr/local/lib/python3.7/dist-packages (from pandas) (2018.9)
Requirement already satisfied: numpy>=1.15.4 in /usr/local/lib/python3.7/dist-packages (from pandas) (1.19.5)
Requirement already satisfied: python-dateutil>=2.7.3 in /usr/local/lib/python3.7/dist-packages (from pandas) (2.8.1)
Requirement already satisfied: six>=1.5 in /usr/local/lib/python3.7/dist-packages (from python-dateutil>=2.7.3->pandas) (1.15.0)import pandas as pddf = pd.read_csv('/content/BostonHousing.csv')df.head()| crim | zn | indus | chas | nox | rm | age | … | |
|---|---|---|---|---|---|---|---|---|
| 0 | 0.00632 | 18.0 | 2.31 | 0 | 0.538 | 6.575 | 65.2 | … |
| 1 | 0.02731 | 0.0 | 7.07 | 0 | 0.469 | 6.421 | 78.9 | … |
| 2 | 0.02729 | 0.0 | 7.07 | 0 | 0.469 | 7.185 | 61.1 | … |
| 3 | 0.03237 | 0.0 | 2.18 | 0 | 0.458 | 6.998 | 45.8 | … |
| 4 | 0.06905 | 0.0 | 2.18 | 0 | 0.458 | 7.147 | 54.2 | … |
print('Machine Learning')Output
Machine Learning!lsOutput
BostonHousing.csv sample_dataKeep going: ← Course overview · Lesson 2 → · Track it in the Self Guide
Finished this one?
Part of Self Guide · Stage 13: ML 1 — Python & Data Basics. Progress is saved in this browser.



