We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
from pandas import DataFrame df = DataFrame({},columns=['time','item','value']) df.pivot('time','item','value')
pandas\core\frame.pyc in pivot(self, index, columns, values) 1953 """ 1954 from pandas.core.reshape import pivot -> 1955 return pivot(self, index=index, columns=columns, values=values) 1956 1957 def stack(self, level=-1, dropna=True):
pandas\core\reshape.pyc in pivot(self, index, columns, values) 220 stacked = stacked.sortlevel(level=0) 221 --> 222 unstacked = stacked.unstack() 223 if values is not None: 224 unstacked.columns = unstacked.columns.droplevel(0)
pandas\core\frame.pyc in unstack(self, level) 2017 return result 2018 else: -> 2019 return unstack(self, level) 2020 2021 def delevel(self):
pandas\core\reshape.pyc in unstack(obj, level) 289 unstacker = _Unstacker(obj.values, obj.index, level=level, 290 value_columns=columns) --> 291 return unstacker.get_result() 292 293 def stack(frame, level=-1, dropna=True):
pandas\core\reshape.pyc in get_result(self) 120 121 # filter out missing levels
--> 122 values = values[:, mask] 123 columns = columns[mask] 124
IndexError: invalid index
The text was updated successfully, but these errors were encountered:
There's also this problem when calling .apply on an empty DataFrame:
pandas\core\frame.pyc in apply(self, func, axis, broadcast, raw) 2203 return self._apply_raw(func, axis) 2204 else: -> 2205 return self._apply_standard(func, axis) 2206 else: 2207 return self._apply_broadcast(func, axis)
pandas\core\frame.pyc in _apply_standard(self, func, axis, ignore_failures) 2257 results[k] = func(v) 2258 -> 2259 if hasattr(results.values()[0], 'iter'): 2260 result = self._constructor(data=results, index=res_columns, 2261 columns=res_index)
IndexError: list index out of range
I'll split these bugs if you'd like- just thought they were similar enough to be combined.
Sorry, something went wrong.
BUG: fix empty DataFrame corner cases described in #378
53ca3f1
thanks. fixed both of these in the above commit. the apply bug was actually not that straightforward to reproduce (see the unit test)
No branches or pull requests
from pandas import DataFrame
df = DataFrame({},columns=['time','item','value'])
df.pivot('time','item','value')
pandas\core\frame.pyc in pivot(self, index, columns, values)
1953 """
1954 from pandas.core.reshape import pivot
-> 1955 return pivot(self, index=index, columns=columns, values=values)
1956
1957 def stack(self, level=-1, dropna=True):
pandas\core\reshape.pyc in pivot(self, index, columns, values)
220 stacked = stacked.sortlevel(level=0)
221
--> 222 unstacked = stacked.unstack()
223 if values is not None:
224 unstacked.columns = unstacked.columns.droplevel(0)
pandas\core\frame.pyc in unstack(self, level)
2017 return result
2018 else:
-> 2019 return unstack(self, level)
2020
2021 def delevel(self):
pandas\core\reshape.pyc in unstack(obj, level)
289 unstacker = _Unstacker(obj.values, obj.index, level=level,
290 value_columns=columns)
--> 291 return unstacker.get_result()
292
293 def stack(frame, level=-1, dropna=True):
pandas\core\reshape.pyc in get_result(self)
120
121 # filter out missing levels
--> 122 values = values[:, mask]
123 columns = columns[mask]
124
IndexError: invalid index
The text was updated successfully, but these errors were encountered: