rand-engine 0.3.7__tar.gz → 0.3.8__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,6 +1,6 @@
1
- Metadata-Version: 2.3
1
+ Metadata-Version: 2.4
2
2
  Name: rand-engine
3
- Version: 0.3.7
3
+ Version: 0.3.8
4
4
  Summary: Rand Engine v2. Package with some methods to generate random data in different formats. Great to mock data while testing or developing.
5
5
  Author: marcoaureliomenezes
6
6
  Author-email: marcoaurelioreislima@gmail.com
@@ -10,6 +10,7 @@ Classifier: Programming Language :: Python :: 3.10
10
10
  Classifier: Programming Language :: Python :: 3.11
11
11
  Classifier: Programming Language :: Python :: 3.12
12
12
  Classifier: Programming Language :: Python :: 3.13
13
+ Classifier: Programming Language :: Python :: 3.14
13
14
  Requires-Dist: fastavro (>=1.10.0,<2.0.0)
14
15
  Requires-Dist: fastparquet (>=2024.11.0,<2025.0.0)
15
16
  Requires-Dist: numpy (>=2.1.1,<3.0.0)
@@ -43,6 +44,6 @@ CoreDistinct().randint(0, 100, 10)
43
44
 
44
45
  ```
45
46
 
46
- git tag 0.0.1
47
+ git tag 0.3.8
47
48
 
48
49
  git push origin --tags
@@ -24,6 +24,6 @@ CoreDistinct().randint(0, 100, 10)
24
24
 
25
25
  ```
26
26
 
27
- git tag 0.0.1
27
+ git tag 0.3.8
28
28
 
29
29
  git push origin --tags
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "rand-engine"
3
- version = "0.3.7"
3
+ version = "0.3.8"
4
4
  description = "Rand Engine v2. Package with some methods to generate random data in different formats. Great to mock data while testing or developing."
5
5
  authors = ["marcoaureliomenezes <marcoaurelioreislima@gmail.com>"]
6
6
  repository = "https://github.com/marcoaureliomenezes/rand_engine"
@@ -12,7 +12,8 @@ class FileWriter:
12
12
  self.write_options = {}
13
13
  self.dict_format = {
14
14
  "csv": self.to_csv,
15
- "parquet": self.to_parquet
15
+ "parquet": self.to_parquet,
16
+ "json": self.to_json
16
17
  }
17
18
 
18
19
  def __handle_fs(self, path, flag=True) -> None:
@@ -89,6 +90,17 @@ class FileWriter:
89
90
  writer = lambda: dataframe().to_csv(full_path, index=False, **self.write_options)
90
91
  return writer
91
92
 
93
+ def to_json(self, dataframe, full_path) -> Callable:
94
+ """
95
+ This method writes a pandas DataFrame to a json file.
96
+ :param dataframe: pd.DataFrame: DataFrame to be written.
97
+ :param full_path: str: Full path of the file to be written.
98
+ :return: Callable: Function to write the Pandas DataFrame to a json file.
99
+ """
100
+ if self.write_options.get("compression"):
101
+ full_path= full_path.replace("json", f"json.{self.write_options['compression']}")
102
+ writer = lambda: dataframe().to_json(full_path, index=False, **self.write_options)
103
+ return writer
92
104
 
93
105
  def to_parquet(self, dataframe, full_path):
94
106
  """
@@ -110,6 +122,7 @@ class FileWriter:
110
122
  """
111
123
  self.__handle_fs(path)
112
124
  dataframe = self.microbatch_def()
125
+ print(dataframe)
113
126
  self.dict_format[self.write_format](dataframe, path)()
114
127
 
115
128