liuyuqi-dellpc 4 years ago
commit
58def31b65
3 changed files with 38 additions and 0 deletions
  1. 5 0
      README.md
  2. 0 0
      data/.gitkeep
  3. 33 0
      main.py

+ 5 - 0
README.md

@@ -0,0 +1,5 @@
+## pakdd-2020
+
+PAKDD2020 阿里巴巴智能运维算法大赛
+
+

+ 0 - 0
data/.gitkeep


+ 33 - 0
main.py

@@ -0,0 +1,33 @@
+#!/usr/bin/env python
+# -*- encoding: utf-8 -*-
+'''
+@Author  :   liuyuqi
+@Contact :   liuyuqi.gov@msn.cn
+@Time    :   2020/02/23 20:21:23
+@Version :   1.0
+@License :   Copyright © 2017-2020 liuyuqi. All Rights Reserved.
+@Desc    :   
+'''
+
+import pandas as pd
+import datetime
+
+
+def run():
+    # df = pd.read_csv("disk_sample_smart_log_test_a.csv", nrows=4)
+    df = pd.read_csv("disk_sample_smart_log_test_a.csv")
+    print(df.iloc[[1]])
+    res = df[["manufacturer", "model", "serial_number", "dt"]]
+    res["dt"] = res['dt'].apply(
+        lambda x: datetime.datetime.strptime(str(x), '%Y%m%d'))
+    res["dt"] = res['dt'].apply(lambda x: x + datetime.timedelta(10))
+
+    save(res)
+
+
+def save(df: pd.DataFrame):
+    df.to_csv("result.csv", header=None, encoding="utf8", index=False)
+
+
+if __name__ == "__main__":
+    run()