Khoa học dữ liệu
Python
Nhập xuất
print(" ")
comment
sử dụng dấu#
khối lệnh
Thụt lệ ít nhất 1 khoảng trắng
function
def
list[kiểu khác nhau]
thêm vào list
insert
append
extend
Xóa
Kiểu dữ liệu trong python
remove
pop
del
clear
sửa
[a:b]
Duyệt
for x in list
for i in range(len(list))
while i in len(list):i=i+1
sắp xếp
Tăng dần
sort
Giảm dân
sort(reverse=True)
copy
list.copy()
Gộp
+
append
extend
tên phần tử
pop(chỉ số)
pop(): lấy cuổi ra
del list[chỉ mục]
del list: xóa cả
làm rỗng thôi
tuple(kiểu dữ liệu khác nhau)
Được sắp xếp
Không thể thay đổi
không thêm, sửa, xóa...
có thể duplicate
Tạo một item trong tuple: tuple = ("apple",)
có duplicate
set{}
dictionary: như kiểu object
class
thừa kế class con(cha)
numpy: xử lý số học
pandas: phân tích dữ liệu
matplotlib: trực quan hóa dữ liệu
biểu đồ đường
plot
plt.plot(x,y,marker='o', mfc='red',mec='green',ms=20,color='red',linestyle=':',linewidth='20'
plt.xlabel("trục hoành");plt.ylabel("trục tung");plt.title("tên biểu đồ")
plt.grid(aixis='x')
plt.show(): hiển thị biểu đồ
Biểu đồ điểm
scatter(s='20',alpha='0.5')
plt.colorbar()
Biểu đồ cột
plt.bar()
plt.barh()
Biểu đồ tròn
plt.pie()