pathpilot 0.3.0__tar.gz → 0.3.2__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.
@@ -1,7 +1,8 @@
1
- Metadata-Version: 2.3
1
+ Metadata-Version: 2.1
2
2
  Name: pathpilot
3
- Version: 0.3.0
3
+ Version: 0.3.2
4
4
  Summary: Library that facilitates file and folder manipulation in Python.
5
+ Home-page: https://github.com/zteinck/pathpilot
5
6
  License: MIT
6
7
  Author: Zachary Einck
7
8
  Author-email: zacharyeinck@gmail.com
@@ -13,14 +14,12 @@ Classifier: Programming Language :: Python :: 3.9
13
14
  Classifier: Programming Language :: Python :: 3.10
14
15
  Classifier: Programming Language :: Python :: 3.11
15
16
  Classifier: Programming Language :: Python :: 3.12
16
- Classifier: Programming Language :: Python :: 3.13
17
17
  Requires-Dist: XlsxWriter
18
18
  Requires-Dist: cachegrab (>=0.2.2)
19
19
  Requires-Dist: clockwork (>=0.3.4)
20
20
  Requires-Dist: numpy
21
21
  Requires-Dist: oddments (>=0.3.1)
22
22
  Requires-Dist: pandas
23
- Project-URL: Homepage, https://github.com/zteinck/pathpilot
24
23
  Project-URL: Repository, https://github.com/zteinck/pathpilot
25
24
  Description-Content-Type: text/markdown
26
25
 
@@ -43,7 +42,7 @@ pip install pathpilot
43
42
 
44
43
 
45
44
  ## Main Features
46
- - `File` ➔ Function that assigns new file instances to the correct child class. Many file types are supported natively including: *.xlsx*, *.csv*, *.txt*, *.pickle*, etc. The mapping of file extensions to their respective classes is managed using the `extension_mapping` global dictionary. Unmapped extensions are assigned to the `FileBase` class.
45
+ - `file_factory` ➔ Function that assigns new file instances to the correct child class. Many file types are supported natively including: *.xlsx*, *.csv*, *.txt*, *.pickle*, etc. The mapping of file extensions to their respective classes is managed using the `extension_mapping` global dictionary. Unmapped extensions are assigned to the `FileBase` class.
47
46
  - `Folder` ➔ Class for interacting with folders. It is important to be mindful of the `read_only` parameter which, if set to `True`, allows folders to be created or deleted programically.
48
47
 
49
48
 
@@ -52,7 +51,7 @@ Please note the examples below represent a small fraction of the functionality o
52
51
 
53
52
  ### Imports
54
53
  ```python
55
- from pathpilot import Folder, File
54
+ from pathpilot import Folder, file_factory
56
55
  ```
57
56
 
58
57
  ### Folders
@@ -80,10 +79,10 @@ new_years_file = january_folder.join('Happy New Year.txt')
80
79
  ```
81
80
 
82
81
  ### Files
83
- First, we create an instance of the `ExcelFile` class using the `File` function. This occurs automatically by virtue of the `.xlsx` file extension.
82
+ First, we create an instance of the `ExcelFile` class using the `file_factory` function. This occurs automatically by virtue of the `.xlsx` file extension.
84
83
  ```python
85
84
  # create ExcelFile instance
86
- file = File(r'C:\Users\MyID\Documents\MyFolder\MyFile.xlsx')
85
+ file = file_factory(r'C:\Users\MyID\Documents\MyFolder\MyFile.xlsx')
87
86
  ```
88
87
 
89
88
  Next, let's check if the file exists. If not, let's save a `pandas` `DataFrame` as an Excel file.
@@ -101,7 +100,7 @@ Creating MyFile.xlsx
101
100
 
102
101
  Now let's read the file we created as a `DataFrame`.
103
102
  ```python
104
- # read the file we created as a pd.DataFrame
103
+ # read the file we created as a pd.DataFrame
105
104
  df = file.read()
106
105
  ```
107
106
 
@@ -17,7 +17,7 @@ pip install pathpilot
17
17
 
18
18
 
19
19
  ## Main Features
20
- - `File` ➔ Function that assigns new file instances to the correct child class. Many file types are supported natively including: *.xlsx*, *.csv*, *.txt*, *.pickle*, etc. The mapping of file extensions to their respective classes is managed using the `extension_mapping` global dictionary. Unmapped extensions are assigned to the `FileBase` class.
20
+ - `file_factory` ➔ Function that assigns new file instances to the correct child class. Many file types are supported natively including: *.xlsx*, *.csv*, *.txt*, *.pickle*, etc. The mapping of file extensions to their respective classes is managed using the `extension_mapping` global dictionary. Unmapped extensions are assigned to the `FileBase` class.
21
21
  - `Folder` ➔ Class for interacting with folders. It is important to be mindful of the `read_only` parameter which, if set to `True`, allows folders to be created or deleted programically.
22
22
 
23
23
 
@@ -26,7 +26,7 @@ Please note the examples below represent a small fraction of the functionality o
26
26
 
27
27
  ### Imports
28
28
  ```python
29
- from pathpilot import Folder, File
29
+ from pathpilot import Folder, file_factory
30
30
  ```
31
31
 
32
32
  ### Folders
@@ -54,10 +54,10 @@ new_years_file = january_folder.join('Happy New Year.txt')
54
54
  ```
55
55
 
56
56
  ### Files
57
- First, we create an instance of the `ExcelFile` class using the `File` function. This occurs automatically by virtue of the `.xlsx` file extension.
57
+ First, we create an instance of the `ExcelFile` class using the `file_factory` function. This occurs automatically by virtue of the `.xlsx` file extension.
58
58
  ```python
59
59
  # create ExcelFile instance
60
- file = File(r'C:\Users\MyID\Documents\MyFolder\MyFile.xlsx')
60
+ file = file_factory(r'C:\Users\MyID\Documents\MyFolder\MyFile.xlsx')
61
61
  ```
62
62
 
63
63
  Next, let's check if the file exists. If not, let's save a `pandas` `DataFrame` as an Excel file.
@@ -75,7 +75,7 @@ Creating MyFile.xlsx
75
75
 
76
76
  Now let's read the file we created as a `DataFrame`.
77
77
  ```python
78
- # read the file we created as a pd.DataFrame
78
+ # read the file we created as a pd.DataFrame
79
79
  df = file.read()
80
80
  ```
81
81
 
@@ -3,5 +3,5 @@ from .decorators import *
3
3
  from .exceptions import *
4
4
  from .utils import *
5
5
 
6
- __version__ = '0.3.0'
6
+ __version__ = '0.3.2'
7
7
  __author__ = 'Zachary Einck <zacharyeinck@gmail.com>'
@@ -828,16 +828,19 @@ class ExcelFile(FileBase):
828
828
  fmt if s.sum() - s.round().sum() == 0 \
829
829
  else f'{fmt}_two_decimals'
830
830
 
831
+ clean_abs_numeric = lambda x: \
832
+ pd.to_numeric(x, errors='coerce').dropna().abs()
833
+
831
834
  for k in numeric_columns:
832
835
  if not df[k].isna().all():
833
- s = df[k].dropna().abs()
836
+ s = clean_abs_numeric(df[k])
834
837
  if s.max() >= 1000:
835
838
  data_format[k] = infer_format('commas', s)
836
839
 
837
840
  for k in percent_columns:
838
841
  if not df[k].isna().all():
839
- s = df[k].dropna().abs()
840
- if s[s > 0].min() >= 1:
842
+ s = clean_abs_numeric(df[k])
843
+ if s.where(s > 0).min() >= 1:
841
844
  df[k] /= 100
842
845
  else:
843
846
  s *= 100
@@ -461,7 +461,7 @@ class FileBase(object):
461
461
 
462
462
 
463
463
  def deep_copy(self):
464
- ''' create a copy of the File object '''
464
+ ''' create a copy of the file object '''
465
465
  return self.spawn(self.path)
466
466
 
467
467
 
@@ -781,7 +781,7 @@ class Folder(object):
781
781
 
782
782
  Returns
783
783
  ----------
784
- out : Folder | File
784
+ out : object
785
785
  folder or file object
786
786
  '''
787
787
  self.validate_join_args(args)
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "pathpilot"
3
- version = "0.3.0"
3
+ version = "0.3.2"
4
4
  description = "Library that facilitates file and folder manipulation in Python."
5
5
  authors = ["Zachary Einck <zacharyeinck@gmail.com>"]
6
6
  license = "MIT"
File without changes
File without changes
File without changes