feilian 1.2.4__tar.gz → 1.2.5__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.

Potentially problematic release.


This version of feilian might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: feilian
3
- Version: 1.2.4
3
+ Version: 1.2.5
4
4
  Summary: General data processing tool.
5
5
  Author-email: darkpeath <darkpeath@gmail.com>
6
6
  Project-URL: Homepage, https://github.com/darkpeath/feilian
@@ -1,5 +1,5 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  # file generated by setuptools_scm
3
3
  # don't change, don't track in version control
4
- VERSION = (1, 2, 4)
5
- __version__ = '1.2.4'
4
+ VERSION = (1, 2, 5)
5
+ __version__ = '1.2.5'
@@ -76,7 +76,14 @@ def read_dataframe(file: str, *args, sheet_name=0,
76
76
  elif file_format == 'xlsx':
77
77
  df = pd.read_excel(file, *args, sheet_name=sheet_name, dtype=dtype, **kwargs)
78
78
  elif file_format == 'json':
79
- df = pd.read_json(file, *args, lines=jsonl, dtype=dtype, **kwargs)
79
+ try:
80
+ df = pd.read_json(file, *args, lines=jsonl, dtype=dtype, **kwargs)
81
+ except Exception as e:
82
+ # if failed, try again with different arg `lines`
83
+ try:
84
+ df = pd.read_json(file, *args, lines=not jsonl, dtype=dtype, **kwargs)
85
+ except Exception:
86
+ raise e
80
87
  elif file_format == 'parquet':
81
88
  df = pd.read_parquet(file, *args, **kwargs)
82
89
  else:
@@ -97,7 +104,7 @@ def save_dataframe(file: Union[str, 'pd.WriteBuffer[bytes]', 'pd.WriteBuffer[st
97
104
  index=False, index_label=None,
98
105
  encoding='utf-8', newline='\n',
99
106
  force_ascii=False,
100
- orient='records', jsonl=True,
107
+ orient='records', jsonl=True, indent=None,
101
108
  column_mapper: Union[Dict[str, str], Sequence[str]] = None,
102
109
  include_columns: Sequence[str] = None,
103
110
  exclude_columns: Sequence[str] = None,
@@ -119,6 +126,7 @@ def save_dataframe(file: Union[str, 'pd.WriteBuffer[bytes]', 'pd.WriteBuffer[st
119
126
  :param force_ascii: `force_ascii` for json format
120
127
  :param orient: `orient` for json format
121
128
  :param jsonl: jsonl format or not
129
+ :param indent: indent for json format
122
130
  :param column_mapper: rename columns; if set, columns not list here will be ignored
123
131
  :param include_columns: if set, columns not list here will be ignored
124
132
  :param exclude_columns: if set, columns list here will be ignored
@@ -180,7 +188,7 @@ def save_dataframe(file: Union[str, 'pd.WriteBuffer[bytes]', 'pd.WriteBuffer[st
180
188
  index = True
181
189
  df.to_json(file, *args, compression=compression, index=index,
182
190
  force_ascii=force_ascii, orient=orient, lines=jsonl,
183
- **kwargs)
191
+ indent=indent, **kwargs)
184
192
  elif file_format == 'parquet':
185
193
  df.to_parquet(file, *args, compression=compression, index=index, **kwargs)
186
194
  else:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: feilian
3
- Version: 1.2.4
3
+ Version: 1.2.5
4
4
  Summary: General data processing tool.
5
5
  Author-email: darkpeath <darkpeath@gmail.com>
6
6
  Project-URL: Homepage, https://github.com/darkpeath/feilian
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes