byzh-core 0.0.9.2__tar.gz → 0.0.9.3__tar.gz

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.
Files changed (31) hide show
  1. {byzh_core-0.0.9.2 → byzh_core-0.0.9.3}/PKG-INFO +1 -1
  2. {byzh_core-0.0.9.2 → byzh_core-0.0.9.3}/byzh/core/Brecorder/record2d.py +32 -7
  3. {byzh_core-0.0.9.2 → byzh_core-0.0.9.3}/byzh_core.egg-info/PKG-INFO +1 -1
  4. {byzh_core-0.0.9.2 → byzh_core-0.0.9.3}/LICENSE +0 -0
  5. {byzh_core-0.0.9.2 → byzh_core-0.0.9.3}/README.md +0 -0
  6. {byzh_core-0.0.9.2 → byzh_core-0.0.9.3}/byzh/core/B_os.py +0 -0
  7. {byzh_core-0.0.9.2 → byzh_core-0.0.9.3}/byzh/core/Barchive/__init__.py +0 -0
  8. {byzh_core-0.0.9.2 → byzh_core-0.0.9.3}/byzh/core/Barchive/archive.py +0 -0
  9. {byzh_core-0.0.9.2 → byzh_core-0.0.9.3}/byzh/core/Brecorder/__init__.py +0 -0
  10. {byzh_core-0.0.9.2 → byzh_core-0.0.9.3}/byzh/core/Brecorder/record1d.py +0 -0
  11. {byzh_core-0.0.9.2 → byzh_core-0.0.9.3}/byzh/core/Btable/__init__.py +0 -0
  12. {byzh_core-0.0.9.2 → byzh_core-0.0.9.3}/byzh/core/Btable/auto_table.py +0 -0
  13. {byzh_core-0.0.9.2 → byzh_core-0.0.9.3}/byzh/core/Bterminal/__init__.py +0 -0
  14. {byzh_core-0.0.9.2 → byzh_core-0.0.9.3}/byzh/core/Bterminal/cmd.py +0 -0
  15. {byzh_core-0.0.9.2 → byzh_core-0.0.9.3}/byzh/core/Bterminal/run_func.py +0 -0
  16. {byzh_core-0.0.9.2 → byzh_core-0.0.9.3}/byzh/core/Btqdm/__init__.py +0 -0
  17. {byzh_core-0.0.9.2 → byzh_core-0.0.9.3}/byzh/core/Btqdm/my_tqdm.py +0 -0
  18. {byzh_core-0.0.9.2 → byzh_core-0.0.9.3}/byzh/core/Butils/__init__.py +0 -0
  19. {byzh_core-0.0.9.2 → byzh_core-0.0.9.3}/byzh/core/Butils/decorator.py +0 -0
  20. {byzh_core-0.0.9.2 → byzh_core-0.0.9.3}/byzh/core/Butils/text_style.py +0 -0
  21. {byzh_core-0.0.9.2 → byzh_core-0.0.9.3}/byzh/core/Butils/timer.py +0 -0
  22. {byzh_core-0.0.9.2 → byzh_core-0.0.9.3}/byzh/core/Bwriter/__init__.py +0 -0
  23. {byzh_core-0.0.9.2 → byzh_core-0.0.9.3}/byzh/core/Bwriter/writer.py +0 -0
  24. {byzh_core-0.0.9.2 → byzh_core-0.0.9.3}/byzh/core/__init__.py +0 -0
  25. {byzh_core-0.0.9.2 → byzh_core-0.0.9.3}/byzh_core.egg-info/SOURCES.txt +0 -0
  26. {byzh_core-0.0.9.2 → byzh_core-0.0.9.3}/byzh_core.egg-info/dependency_links.txt +0 -0
  27. {byzh_core-0.0.9.2 → byzh_core-0.0.9.3}/byzh_core.egg-info/entry_points.txt +0 -0
  28. {byzh_core-0.0.9.2 → byzh_core-0.0.9.3}/byzh_core.egg-info/requires.txt +0 -0
  29. {byzh_core-0.0.9.2 → byzh_core-0.0.9.3}/byzh_core.egg-info/top_level.txt +0 -0
  30. {byzh_core-0.0.9.2 → byzh_core-0.0.9.3}/setup.cfg +0 -0
  31. {byzh_core-0.0.9.2 → byzh_core-0.0.9.3}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: byzh-core
3
- Version: 0.0.9.2
3
+ Version: 0.0.9.3
4
4
  Summary: byzh-core是byzh系列的核心库,包含了一些常用的工具函数和类。
5
5
  Author: byzh_rc
6
6
  License: MIT
@@ -1,7 +1,8 @@
1
1
  import pandas as pd
2
2
  from typing import Literal
3
3
 
4
- from .. import B_os
4
+ # from .. import B_os
5
+ from byzh.core import B_os
5
6
 
6
7
  class B_Record2d:
7
8
  def __init__(self, csv_path, mode:Literal["w", "a"]="w"):
@@ -17,16 +18,38 @@ class B_Record2d:
17
18
 
18
19
  # 支持 recorder[row, col] 访问
19
20
  def __getitem__(self, key):
20
- row, col = key
21
- row, col = str(row), str(col)
22
- return self.data.loc[row, col]
21
+ if isinstance(key, tuple) and len(key) == 2: # 读值操作
22
+ row, col = key
23
+ row, col = str(row), str(col)
24
+ return self.data.loc[row, col]
25
+ if isinstance(key, str): # 读行操作
26
+ row = str(key)
27
+ return self.data.loc[row, :]
23
28
 
24
29
  # 支持 recorder[row, col] = value
25
30
  def __setitem__(self, key, value):
26
- row, col = key
27
- row, col, value = str(row), str(col), str(value)
28
- self.data.loc[row, col] = value
31
+ if isinstance(key, tuple) and len(key) == 2: # 赋值操作
32
+ row, col = key
33
+ row, col, value = str(row), str(col), str(value)
34
+ self.data.loc[row, col] = value
35
+ self.__save()
36
+ if isinstance(key, str): # 赋值行操作
37
+ assert type(value) == pd.Series, "仅支持 Series 赋值"
38
+ key = str(key)
39
+ self.data.loc[key, :] = value.copy()
40
+
41
+ # 复制一行
42
+ def copy_row(self, new_row, origin_row):
43
+ new_row, origin_row = str(new_row), str(origin_row)
44
+
45
+ if origin_row not in self.data.index:
46
+ raise KeyError(f"源行 {origin_row} 不存在")
47
+
48
+ # 深拷贝一份行数据
49
+ self.data.loc[new_row] = self.data.loc[origin_row].copy()
50
+
29
51
  self.__save()
52
+ return self
30
53
 
31
54
  # 转置
32
55
  def T(self):
@@ -85,6 +108,8 @@ if __name__ == '__main__':
85
108
  recorder["qwq", "OvO"] = 30
86
109
  recorder["qwq", "TwT"] = 40
87
110
 
111
+ recorder['aaa'] = recorder['qwwq']
112
+
88
113
  print("当前内容:")
89
114
  print(recorder)
90
115
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: byzh-core
3
- Version: 0.0.9.2
3
+ Version: 0.0.9.3
4
4
  Summary: byzh-core是byzh系列的核心库,包含了一些常用的工具函数和类。
5
5
  Author: byzh_rc
6
6
  License: MIT
File without changes
File without changes
File without changes
File without changes