บทนำ

Python สำหรับผู้ใช้ R

Daniel Chen

Instructor

พื้นฐาน

  • ตัวแปร
  • การกำหนดค่า
  • สตริง
  • ลิสต์
  • ดิกชันนารี
Python สำหรับผู้ใช้ R

พื้นฐานการเขียนโปรแกรม

  • การควบคุมการไหลของโปรแกรม (if-statements)
  • ลูป
  • ฟังก์ชัน
Python สำหรับผู้ใช้ R

Pandas

  • การเลือกและกรองข้อมูล
  • ชนิดข้อมูล
  • เทคนิคการจัดการและประมวลผลข้อมูล
Python สำหรับผู้ใช้ R

การสร้างกราฟ

  • pandas
  • matplotlib
  • seaborn
Python สำหรับผู้ใช้ R

นำทุกอย่างมารวมกัน

  • ชุดข้อมูล NYC Flights 2013
  • เครื่องบิน
  • ความล่าช้าของเที่ยวบิน
Python สำหรับผู้ใช้ R

ชนิดข้อมูลใน Python

R
  • numeric: จำนวนเต็มและทศนิยม
  • logical: ค่า TRUE หรือ FALSE
  • character: สตริง
Python
  • int: จำนวนเต็ม
  • float: จำนวนทศนิยม
  • bool: ค่า True หรือ False
  • str: สตริง
Python สำหรับผู้ใช้ R

การกำหนดค่า

R
x <- 3

y = 0.5

z <- TRUE
Python
x = 3

y = 0.5

z = True
Python สำหรับผู้ใช้ R

คำสั่ง print

R
print('R is awesome!')
"R is awesome!"
Python
print('Python too!')
Python too!
Python สำหรับผู้ใช้ R

ชนิดข้อมูลของคุณคืออะไร?

R
x <- 3

class(x)
"numeric"
Python
x = 3

type(x)
int
y = 0.5

type(y)
float
Python สำหรับผู้ใช้ R
R
1 + 1
2
'1' + '1'
Error in "1" + "1" : non-numeric argument to binary operator
'1' * 5
Error in "1" * 5 : non-numeric argument to binary operator
'1' '1'
Error: unexpected string constant in "'1' '1'"
Python สำหรับผู้ใช้ R
Python
1 + 1
2
'1' + '1'
'11'
'1' * 5
'11111'
'1' '1'
'11'
Python สำหรับผู้ใช้ R

มาฝึกกันเถอะ!

Python สำหรับผู้ใช้ R

Preparing Video For Download...