Muyi 0.0.1__py3-none-any.whl → 0.0.2__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.
@@ -0,0 +1,46 @@
1
+ Metadata-Version: 2.1
2
+ Name: Muyi
3
+ Version: 0.0.2
4
+ Summary: Some useful utils.
5
+ Home-page: https://github.com/Muyiiiii/muyi
6
+ Author: muyiiiii
7
+ Author-email:
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Operating System :: OS Independent
11
+ Requires-Python: >=3
12
+ Description-Content-Type: text/markdown
13
+ License-File: LICENSE
14
+
15
+ # muyi
16
+
17
+ Some useful utils for GNNs and Deep Learning.
18
+
19
+
20
+
21
+ ```bash
22
+ pip install muyi
23
+ ```
24
+
25
+
26
+
27
+
28
+
29
+ ## utils
30
+
31
+ 1. `color_print(content)`
32
+ 2. `save_pic_iterly(pic_name, postfix, info)`
33
+ 3. `read_csv_iterly(path, **kwargs)`
34
+
35
+
36
+
37
+ ## graph
38
+
39
+ 1. `pyg_data_to_dgl_graph(pyg_data_obj)`
40
+
41
+
42
+
43
+ ## gpu
44
+
45
+ 1. `get_gpu_memory_usage()`
46
+ 2. `display_gpu_memory_usage()`
@@ -0,0 +1,9 @@
1
+ muyi/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ muyi/gpu.py,sha256=JLr-hQ84gv7afgFX6XHaquvN-HB19NqvwHxoq-rugdM,676
3
+ muyi/graph.py,sha256=4okLvgp0TboSpuKtlzXTTbLin2K-RMVxhqJ7CZt6Tps,1145
4
+ muyi/utils.py,sha256=Mulmh8T7r5YHum8CgceOURyJgvzHzCZV0FPZurmhgys,1385
5
+ Muyi-0.0.2.dist-info/LICENSE,sha256=GzHS9pi6vw_oGwKIGxAPch8iuVrHazOilEsYL7AlPK0,1085
6
+ Muyi-0.0.2.dist-info/METADATA,sha256=6QuPjmjJBNfALSMd5gAXN_kNc9i4XHn0neuCrLzB1C0,763
7
+ Muyi-0.0.2.dist-info/WHEEL,sha256=y4mX-SOX4fYIkonsAGA5N0Oy-8_gI4FXw5HNI1xqvWg,91
8
+ Muyi-0.0.2.dist-info/top_level.txt,sha256=3X0xmx0SvmCNEj1ISqmD2evKh_ejCJQaLA4GEbGfKc4,5
9
+ Muyi-0.0.2.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.43.0)
2
+ Generator: setuptools (70.2.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
muyi/utils.py CHANGED
@@ -1,5 +1,7 @@
1
1
  import os
2
2
  import matplotlib.pyplot as plt
3
+ import pandas as pd
4
+ from tqdm import tqdm
3
5
 
4
6
  def color_print(content):
5
7
  print(f'\033[1;46m{content}\033[0m\n')
@@ -16,3 +18,26 @@ def save_pic_iterly(pic_name, postfix, info):
16
18
  plt.savefig(pic_name_full, dpi=300, bbox_inches='tight')
17
19
 
18
20
  color_print(f'!!!!! {info} is saved in file {pic_name_full}')
21
+
22
+ def read_csv_iterly(path, **kwargs):
23
+ INPUT_FILENAME = path
24
+ LINES_TO_READ_FOR_ESTIMATION = 20
25
+ CHUNK_SIZE_PER_ITERATION = 10**5
26
+
27
+
28
+ temp = pd.read_csv(INPUT_FILENAME,
29
+ nrows=LINES_TO_READ_FOR_ESTIMATION, **kwargs)
30
+ N = len(temp.to_csv(index=False))
31
+ df = [temp[:0]]
32
+ t = int(os.path.getsize(INPUT_FILENAME)/N*LINES_TO_READ_FOR_ESTIMATION/CHUNK_SIZE_PER_ITERATION) + 1
33
+
34
+
35
+ with tqdm(total = t, file = sys.stdout) as pbar:
36
+ for i,chunk in enumerate(pd.read_csv(INPUT_FILENAME, chunksize=CHUNK_SIZE_PER_ITERATION, low_memory=False, **kwargs)):
37
+ df.append(chunk)
38
+ pbar.set_description('Importing: %d' % (1 + i))
39
+ pbar.update(1)
40
+
41
+ data = temp[:0].append(df)
42
+ del df
43
+ return data
@@ -1,16 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: Muyi
3
- Version: 0.0.1
4
- Summary: Some useful utils.
5
- Author: muyiiiii
6
- Author-email:
7
- Classifier: Programming Language :: Python :: 3
8
- Classifier: License :: OSI Approved :: MIT License
9
- Classifier: Operating System :: OS Independent
10
- Requires-Python: >=3
11
- Description-Content-Type: text/markdown
12
- License-File: LICENSE
13
-
14
- # muyi_utils
15
-
16
- Some useful utils for GNNs and Deep Learning.
@@ -1,9 +0,0 @@
1
- muyi/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- muyi/gpu.py,sha256=JLr-hQ84gv7afgFX6XHaquvN-HB19NqvwHxoq-rugdM,676
3
- muyi/graph.py,sha256=4okLvgp0TboSpuKtlzXTTbLin2K-RMVxhqJ7CZt6Tps,1145
4
- muyi/utils.py,sha256=WC71JmaDYw3wioP5vlCnQphNkQoE336b4X5rH3EVbEQ,540
5
- Muyi-0.0.1.dist-info/LICENSE,sha256=GzHS9pi6vw_oGwKIGxAPch8iuVrHazOilEsYL7AlPK0,1085
6
- Muyi-0.0.1.dist-info/METADATA,sha256=934n3ICwZiX_3XYhRvP9YaCG46H49Y_I9bIKQ3VhMFg,414
7
- Muyi-0.0.1.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
8
- Muyi-0.0.1.dist-info/top_level.txt,sha256=3X0xmx0SvmCNEj1ISqmD2evKh_ejCJQaLA4GEbGfKc4,5
9
- Muyi-0.0.1.dist-info/RECORD,,
File without changes