mdbq 0.1.4__py3-none-any.whl → 0.1.5__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -24,6 +24,7 @@ class DataFrameConverter(object):
24
24
  df.replace(to_replace=['="'], value='', regex=True, inplace=True) # ="和"不可以放在一起清洗, 因为有: id=86785565
25
25
  df.replace(to_replace=['"'], value='', regex=True, inplace=True)
26
26
  cols = df.columns.tolist()
27
+
27
28
  for col in cols:
28
29
  # df[col] = df[col].apply(lambda x: re.sub('[="]', '', str(x)) if '="' in str(x) else x)
29
30
  # 百分比在某些数据库中不兼容, 转换百分比为小数
@@ -31,9 +32,14 @@ class DataFrameConverter(object):
31
32
  # 尝试转换合适的数据类型
32
33
  if df[col].dtype == 'object':
33
34
  try:
34
- df[col] = df[col].astype(int) # 尝试转换 int
35
+ # df[col] = df[col].astype(int) # 尝试转换 int
36
+ df[col] = df[col].apply(lambda x: int(x) if '_' not in str(x) else x)
35
37
  except:
36
- df[col] = df[col].astype('float64', errors='ignore') # 尝试转换 float, 报错则忽略
38
+ # df[col] = df[col].astype('float64', errors='ignore') # 尝试转换 float, 报错则忽略
39
+ try:
40
+ df[col] = df[col].apply(lambda x: float(x) if '_' not in str(x) else x)
41
+ except:
42
+ pass
37
43
  if df[col].dtype == 'float': # 对于小数类型, 保留 6 位小数
38
44
  df[col] = df[col].apply(lambda x: round(float(x), 6) if x != 0 else x)
39
45
  # 清理列名, 在 mysql 里面列名不能含有某些特殊字符
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mdbq
3
- Version: 0.1.4
3
+ Version: 0.1.5
4
4
  Home-page: https://pypi.org/project/mdbsql
5
5
  Author: xigua,
6
6
  Author-email: 2587125111@qq.com
@@ -13,7 +13,7 @@ mdbq/config/__init__.py,sha256=jso1oHcy6cJEfa7udS_9uO5X6kZLoPBF8l3wCYmr5dM,18
13
13
  mdbq/config/get_myconf.py,sha256=9v3xebfcS1tptxpvk3_tGxfXjAehGVCveYe4iRUzLQQ,6372
14
14
  mdbq/config/update_conf.py,sha256=YjGjjRchu5BcrmLJkoLjHEF2TbGOmsgCWX4LroXOYWQ,3455
15
15
  mdbq/dataframe/__init__.py,sha256=2HtCN8AdRj53teXDqzysC1h8aPL-mMFy561ESmhehGQ,22
16
- mdbq/dataframe/converter.py,sha256=5hrGx-lPVwYLuyZNOHf6K7O9_AAKZ7mCp0MHxlxSCnk,2816
16
+ mdbq/dataframe/converter.py,sha256=h_BDc6oNmMCVFOUzZJq4nXNGDyJFJyycpWqlyrv7U04,3089
17
17
  mdbq/log/__init__.py,sha256=Mpbrav0s0ifLL7lVDAuePEi1hJKiSHhxcv1byBKDl5E,15
18
18
  mdbq/log/mylogger.py,sha256=oaT7Bp-Hb9jZt52seP3ISUuxVcI19s4UiqTeouScBO0,3258
19
19
  mdbq/mongo/__init__.py,sha256=SILt7xMtQIQl_m-ik9WLtJSXIVf424iYgCfE_tnQFbw,13
@@ -30,7 +30,7 @@ mdbq/pbix/__init__.py,sha256=Trtfaynu9RjoTyLLYBN2xdRxTvm_zhCniUkVTAYwcjo,24
30
30
  mdbq/pbix/pbix_refresh.py,sha256=JUjKW3bNEyoMVfVfo77UhguvS5AWkixvVhDbw4_MHco,2396
31
31
  mdbq/pbix/refresh_all.py,sha256=wulHs4rivf4Mi0Pii2QR5Nk9-TBcvSwnCB_WH9QULKE,5939
32
32
  mdbq/spider/__init__.py,sha256=RBMFXGy_jd1HXZhngB2T2XTvJqki8P_Fr-pBcwijnew,18
33
- mdbq-0.1.4.dist-info/METADATA,sha256=36-EtjU3OviSuiID5CH5XrLaHodQW3vIYXwtv6d2acI,245
34
- mdbq-0.1.4.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
35
- mdbq-0.1.4.dist-info/top_level.txt,sha256=2FQ-uLnCSB-OwFiWntzmwosW3X2Xqsg0ewh1axsaylA,5
36
- mdbq-0.1.4.dist-info/RECORD,,
33
+ mdbq-0.1.5.dist-info/METADATA,sha256=X-iiiuZTrT9STDW8bThvKswQ_cLjqv_rqdIVZ4Of4oI,245
34
+ mdbq-0.1.5.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
35
+ mdbq-0.1.5.dist-info/top_level.txt,sha256=2FQ-uLnCSB-OwFiWntzmwosW3X2Xqsg0ewh1axsaylA,5
36
+ mdbq-0.1.5.dist-info/RECORD,,
File without changes