Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

도시공학도와 파이썬

751 views

Published on

2017년 10월 파이썬 세미나 [Python & Data] 발표 자료

Published in: Engineering
  • Be the first to comment

도시공학도와 파이썬

  1. 1. ? winterj.me@gmail.com JungWinter
  2. 2. 10%
  3. 3. 30% ?
  4. 4. ? 50%
  5. 5. NOW
  6. 6. ?
  7. 7. “ ” ? ? ?
  8. 8. 2
  9. 9. .hwp
  10. 10. 
 = Flask + kakaoAPI
  11. 11. 
 = Flask + kakaoAPI ? ? ? JSON? REST?
  12. 12.
  13. 13. Log
  14. 14. def viewLog(mode, data=None): if mode is "message": app.logger.info("[message] user_key : {}, type : {}, content : {}".format( data["user_key"], data["type"], data["content"])) elif mode is "keyboard": app.logger.info("[keyboard] call home keyboard") elif mode is "add": app.logger.info("[join] user_key : {}".format(data["user_key"])) elif mode is "block": app.logger.info("[block] user_key : {}".format(data)) elif mode is "exit": app.logger.info("[exit] user_key : {}".format(data)) elif mode is "fail": app.logger.info("[fail] request process fail")
  15. 15. def viewLog(mode, data=None): if mode is "message": app.logger.info("[message] user_key : {}, type : {}, content : {}".format( data["user_key"], data["type"], data["content"])) elif mode is "keyboard": app.logger.info("[keyboard] call home keyboard") elif mode is "add": app.logger.info("[join] user_key : {}".format(data["user_key"])) elif mode is "block": app.logger.info("[block] user_key : {}".format(data)) elif mode is "exit": app.logger.info("[exit] user_key : {}".format(data)) elif mode is "fail": app.logger.info("[fail] request process fail")
  16. 16. ? Matplotlib?
  17. 17. plt.xkcd()
  18. 18. GIS
  19. 19. GIS
  20. 20. QGIS
  21. 21. # text format # 201509|74000|1|0|0|500 # time, code, weekend, gender, age, pop from time import time filename = input("input text file name : ") start = int(input("input start range : ")) end = int(input("input end range : ")) with open("out1_" + filename, mode = "w", encoding="UTF-8") as fp1: with open(filename, mode="r", encoding="UTF-8") as fp2: startTime = time() print("calculating file's line number ...") numLines = sum(1 for line in open(filename)) processTime = time() - startTime print("done in %.5fs. total %d lines" % (processTime, numLines)) print("start next process ...") startTime = time() chunk = int(numLines / 10) for i in range(numLines): if i % chunk == 0: print("%d / %d (%.5f)" % (i, numLines, time() - startTime)) line = fp2.readline() code = line.split("|")[1] if start <= code <= end: fp1.write(line) processTime = time() - startTime print("done in %.5f" % processTime)
  22. 22. + PyPy
  23. 23. ...
  24. 24.
  25. 25. Python 3 Jupyter Pandas Matplotlib Scikit-learn
  26. 26. ? ?
  27. 27. ...
  28. 28. from collections import defaultdict
  29. 29. GPS ...
  30. 30. ==
  31. 31. ?
  32. 32. 32%
  33. 33. 32% ?
  34. 34. X X
  35. 35. GIS
  36. 36. Python 3 Jupyter Pandas Matplotlib Scikit-learn
  37. 37. plt.xkcd() from IPython.core.interactiveshell import InteractiveShell InteractiveShell.ast_node_interactivity = "all"
  38. 38. ,
  39. 39. winterj.me@gmail.com JungWinter res_tin

×