Coder Social home page Coder Social logo

py_import_excel's Introduction

py_import_excel

py_import_excel

Tạo môi trường

pip install virtualenv
pip install xlrd
virtualenv py_import_excel_env

python -m pip install jupyter
jupyter notebook

Cấu hình VSCode

Kích hoạt VSCode chạy môi trường ảo virtualenv

C:\Users\soiqu\AppData\Roaming\Code\User\settings.json

{
    "workbench.iconTheme": "material-icon-theme",
    "editor.fontSize": 18,
    "workbench.colorTheme": "One Dark Pro",
    "git.autofetch": true,
    "git.enableSmartCommit": true,
    "extensions.ignoreRecommendations": true,
    "python.pythonPath": "D:/sync/websvr/python/py_import_excel_env/Scripts/python.exe"
}

Chạy Jupyter của môi trường ảo trong VSCode

https://code.visualstudio.com/docs/python/jupyter-support

Jupyter reload module when run a cell

import importlib

sys.path.append('lib/')
import Py4Sqlite3 as db
import funcs
importlib.reload(funcs)

Check lỗi dữ liệu Excel

  • Check formate date
  • Check trạm đo có tồn tại hay không để lấy mã số
  • Check giá trị null, là số hay không
    • null vẫn lấy để lưu vào db

Kết quả lỗi trả về có dạng

{'type': 'err', 'info': 'Lỗi! Dòng 17 không có giá trị'}

type có 3 dạng

  • success: File hợp lệ, có thể import
  • warning: Cảnh báo, vẫn thế thể import
  • error: Lỗi, không được phép import
[
  {
    "type": "success",
    "info": "File h\u1ee3p l\u1ec7."
  },
  {
    "type": "warning",
    "info": "C\u1ea3nh b\u00e1o! D\u00f2ng 2508 kh\u00f4ng c\u00f3 gi\u00e1 tr\u1ecb"
  },
  {
    "type": "error",
    "info": "L\u1ed7i d\u00f2ng 4, \u0111\u1ecbnh d\u1ea1ng c\u1ee7a \"2017-01-03 00:00:00\" ph\u1ea3i l\u00e0 YYYY-MM-DD"
  }
]

Build services

Dùng flash

pip install flash
pip install flask_cors

pip install requests

pip install cryptography
pip install paramiko

http://localhost:5000/import/cctl_giatri_mucnuoc

Muốn hotreload khi test thì thêm option debug

if __name__ == "__main__":
	app.run(debug=True)

References

https://dothanhlong.org/thu-cai-geo-notebook/

https://www.journaldev.com/33306/pandas-read_excel-reading-excel-file-in-python

https://towardsdatascience.com/jypyter-notebook-shortcuts-bf0101a98330

Format date python

https://www.w3schools.com/python/python_datetime.asp

x = datetime.datetime.now()
print(x.strftime("%d-%m-%Y_%Hh%Mm%S"))

py_import_excel's People

Contributors

soiqualang avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.