-
Notifications
You must be signed in to change notification settings - Fork 7.1k
Clean up syntax for supported Python versions. #1963
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
c801000
efa5ec8
f9fd906
62fbd28
0b8f3f6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -260,7 +260,7 @@ def __repr__(self): | |
| # The split here is so that we don't repr pandas row lengths. | ||
| result = self._repr_helper_() | ||
| final_result = repr(result).rsplit("\n\n", maxsplit=1)[0] + \ | ||
| "\n\n[{0} rows x {1} columns]".format(len(self.index), | ||
| "\n\n[{} rows x {} columns]".format(len(self.index), | ||
|
||
| len(self.columns)) | ||
| return final_result | ||
|
|
||
|
|
@@ -279,7 +279,7 @@ def _repr_html_(self): | |
| # We split so that we insert our correct dataframe dimensions. | ||
| result = self._repr_helper_()._repr_html_() | ||
| return result.split('<p>')[0] + \ | ||
| '<p>{0} rows × {1} columns</p>\n</div>'.format(len(self.index), | ||
| '<p>{} rows × {} columns</p>\n</div>'.format(len(self.index), | ||
| len(self.columns)) | ||
|
|
||
| def _get_index(self): | ||
|
|
@@ -527,7 +527,7 @@ def applymap(self, func): | |
| """ | ||
| if not callable(func): | ||
| raise ValueError( | ||
| "\'{0}\' object is not callable".format(type(func))) | ||
| "\'{}\' object is not callable".format(type(func))) | ||
|
|
||
| new_block_partitions = np.array([ | ||
| _map_partitions(lambda df: df.applymap(func), block) | ||
|
|
@@ -1601,7 +1601,7 @@ def fillna(self, value=None, method=None, axis=None, inplace=False, | |
|
|
||
| if isinstance(value, (list, tuple)): | ||
| raise TypeError('"value" parameter must be a scalar or dict, but ' | ||
| 'you passed a "{0}"'.format(type(value).__name__)) | ||
| 'you passed a "{}"'.format(type(value).__name__)) | ||
| if value is None and method is None: | ||
| raise ValueError('must specify a fill method or value') | ||
| if value is not None and method is not None: | ||
|
|
@@ -1875,7 +1875,7 @@ def info_helper(df): | |
| index_string = self.index.summary() + '\n' | ||
|
|
||
| # A column header is needed in the inf() output | ||
| col_header = 'Data columns (total {0} columns):\n'.format( | ||
| col_header = 'Data columns (total {} columns):\n'.format( | ||
| len(self.columns)) | ||
|
|
||
| # Parse the per-partition values to get the per-column details | ||
|
|
@@ -1884,15 +1884,15 @@ def info_helper(df): | |
| col_lines = [prog.match(line) for line in lines] | ||
| cols = [c.group(0) for c in col_lines if c is not None] | ||
| # replace the partition columns names with real column names | ||
| columns = ["{0}\t{1}\n".format(self.columns[i], | ||
| columns = ["{}\t{}\n".format(self.columns[i], | ||
| cols[i].split(" ", 1)[1]) | ||
| for i in range(len(cols))] | ||
| col_string = ''.join(columns) + '\n' | ||
|
|
||
| # A summary of the dtypes in the dataframe | ||
| dtypes_string = "dtypes: " | ||
| for dtype, count in self.dtypes.value_counts().iteritems(): | ||
| dtypes_string += "{0}({1}),".format(dtype, count) | ||
| dtypes_string += "{}({}),".format(dtype, count) | ||
| dtypes_string = dtypes_string[:-1] + '\n' | ||
|
|
||
| # Compute the memory usage by summing per-partitions return values | ||
|
|
@@ -1907,10 +1907,10 @@ def info_helper(df): | |
| if len(mem_vals) != 0: | ||
| # Sum memory usage from each partition | ||
| if memory_usage != 'deep': | ||
| memory_string = 'memory usage: {0}+ bytes'.format( | ||
| memory_string = 'memory usage: {}+ bytes'.format( | ||
| sum(mem_vals)) | ||
| else: | ||
| memory_string = 'memory usage: {0} bytes'.format(sum(mem_vals)) | ||
| memory_string = 'memory usage: {} bytes'.format(sum(mem_vals)) | ||
|
|
||
| # Combine all the components of the info() output | ||
| result = ''.join([class_string, index_string, col_header, | ||
|
|
@@ -1939,10 +1939,10 @@ def insert(self, loc, column, value, allow_duplicates=False): | |
| "Length of values does not match length of index") | ||
| if not allow_duplicates and column in self.columns: | ||
| raise ValueError( | ||
| "cannot insert {0}, already exists".format(column)) | ||
| "cannot insert {}, already exists".format(column)) | ||
| if loc > len(self.columns): | ||
| raise IndexError( | ||
| "index {0} is out of bounds for axis 0 with size {1}".format( | ||
| "index {} is out of bounds for axis 0 with size {}".format( | ||
| loc, len(self.columns))) | ||
| if loc < 0: | ||
| raise ValueError("unbounded slice") | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's not make any changes to this file as it is directly copied from the cloudpickle repository.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. Put in a PR w/cloudpickle to change that though.