|
1 | 1 | from __future__ import absolute_import
|
2 | 2 |
|
3 |
| -import warnings |
4 |
| - |
5 | 3 | import numpy as np
|
6 | 4 | import pandas as pd
|
7 | 5 | from bson import Code
|
@@ -200,11 +198,11 @@ def _get_filter(self, specs):
|
200 | 198 | if isinstance(specs, np.ndarray):
|
201 | 199 | specs = specs.tolist()
|
202 | 200 | if (isinstance(specs, enumerable_types)
|
203 |
| - and isscalar(specs[0]) and len(idx_cols) == 1 |
204 |
| - and not any(isinstance(s, slice) for s in specs)): |
| 201 | + and isscalar(specs[0]) and len(idx_cols) == 1 |
| 202 | + and not any(isinstance(s, slice) for s in specs)): |
205 | 203 | # single column index with list of scalar values
|
206 | 204 | if (self.positional and isinstance(specs, tuple) and len(specs) == 2
|
207 |
| - and all(isscalar(v) for v in specs)): |
| 205 | + and all(isscalar(v) for v in specs)): |
208 | 206 | # iloc[int, int] is a cell access
|
209 | 207 | flt_kwargs[idx_cols[0]] = specs[0]
|
210 | 208 | projection = self._get_projection(specs[1])
|
@@ -430,6 +428,7 @@ def _getcopy_kwargs(self, without=None):
|
430 | 428 | metadata=self.metadata,
|
431 | 429 | query=self.filter_criteria,
|
432 | 430 | auto_inspect=self.auto_inspect,
|
| 431 | + parser=self._parser, |
433 | 432 | preparefn=self._preparefn)
|
434 | 433 | [kwargs.pop(k) for k in make_tuple(without or [])]
|
435 | 434 | return kwargs
|
@@ -767,7 +766,7 @@ def merge(self, right, on=None, left_on=None, right_on=None,
|
767 | 766 | target_name = self._get_collection_name_of(
|
768 | 767 | target, '_temp.merge.%s' % uuid4().hex)
|
769 | 768 | target_field = (
|
770 |
| - "%s_%s" % (right_name.replace('.', '_'), right_on or on)) |
| 769 | + "%s_%s" % (right_name.replace('.', '_'), right_on or on)) |
771 | 770 | """
|
772 | 771 | TODO enable filter criteria on right dataframe. requires changing LOOKUP syntax from
|
773 | 772 | equitly to arbitray match
|
@@ -1010,7 +1009,7 @@ def iterrows(self, chunksize=1000):
|
1010 | 1009 | else:
|
1011 | 1010 | # Series does not have iterrows
|
1012 | 1011 | for i in range(0, len(chunkdf), chunksize):
|
1013 |
| - yield chunkdf.iloc[i:i+chunksize] |
| 1012 | + yield chunkdf.iloc[i:i + chunksize] |
1014 | 1013 |
|
1015 | 1014 | def iteritems(self):
|
1016 | 1015 | if not hasattr(pd.DataFrame, 'iteritems'):
|
@@ -1048,7 +1047,6 @@ def rows(self, start=None, end=None, chunksize=1000):
|
1048 | 1047 | start, end, chunksize = (int(v) for v in (start, end, chunksize))
|
1049 | 1048 | return self.iloc[slice(start, end)].iterchunks(chunksize)
|
1050 | 1049 |
|
1051 |
| - |
1052 | 1050 | def __repr__(self):
|
1053 | 1051 | kwargs = ', '.join('{}={}'.format(k, v) for k, v in self._getcopy_kwargs().items())
|
1054 | 1052 | return "MDataFrame(collection={collection.name}, {kwargs})".format(collection=self.collection,
|
|
0 commit comments