User
Write something
Link buoi hom nay
https://kth-se.zoom.us/j/66153096884#success
0
0
Link lớp học hôm nay
https://kth-se.zoom.us/j/66153096884
0
0
Link buổi học ngày hôm nay
https://kth-se.zoom.us/j/66153096884#success
1
0
Phát động class challenge (giải nhất 50 EUR)
Giải nhất 50 EUR. Ngoài ra, tất cả các bạn tham gia đều nhận được quyển e-book Python Crash Course (dài 564 trang), 25% off khoá tiếp theo của mình, cùng với Python Skill Certificate để các bạn share trên Linkedin. Các thức tham gia như trong attached file nha.
1
0
Nội dung buổi Tutorial ngày hôm nay
Buổi hôm nay mình có cover các nội dung như sau: - How to get data from sharepoints? Link tham khảo https://pypi.org/project/Office365-REST-Python-Client/ import json from office365.runtime.auth.user_credential import UserCredential from office365.sharepoint.request import SharePointRequest site_url = "https://{your-tenant-prefix}.sharepoint.com" request = SharePointRequest(site_url).with_credentials(UserCredential("{username}", "{password}")) response = request.execute_request("web") json = json.loads(response.content) web_title = json['d']['Title'] print("Web title: {0}".format(web_title)) Rồi từ json data, tạo dataframe như bình thường: df = pd.DataFrame([json]) - How can we get the data from SQL server? Có nhiều cách, đơn giản nhất thì dùng pyocdb https://www.codecademy.com/resources/docs/python/sql-connectors/pyodbc import pyocdb # Connect to the database connection = pyodbc.connect("Driver={Driver_Name};" "Server=server_name;" "Database=database_name;" "UID=user_id;" "PWD=password;") # Create a cursor object cursor = connection.cursor() # Execute a query cursor.execute("SQL QUERY") # Fetch results rows = cursor.fetchall() # Process results for row in rows: print(row) --------> Từ each row tạo dataframe như bình thường # Close the connection connection.close() Cách clean hơn là dùng SQLAlchemy dành cho các bạn muốn nâng cao. Nhưng phải hiểu về class: SQLAlchemy: https://docs.sqlalchemy.org/en/20/orm/quickstart.html - How can we get the data from an API? Link tham khảo: https://realpython.com/python-api/ import requests response = requests.get("https://api.thecatapi.com/") pd.DataFrame([response.text]) ----> Chuyển thành dataframe rồi làm thao tác như bình thường. Nếu data update liên tục thì có thể schedule Python script
0
0
Nội dung buổi Tutorial ngày hôm nay
1-30 of 32
powered by
Practical Python for Career Up
skool.com/practical-python-for-career-up-1037
Our Data Community is a welcoming space for learners and enthusiasts of all levels to come together, share knowledge, and grow their coding skills.
Build your own community
Bring people together around your passion and get paid.
Powered by