np.random.seed(12345) panel = pd.Panel(np.random.randn(125,200,10)) panel.iloc[:,:,0] = np.round(panel.iloc[:,:,0]) panel.iloc[:,:,1] = np.round(panel.iloc[:,:,1]) x = panel cols = [0,1] _x = x.swapaxes(0, 2).to_frame() numeric_cols = [] for df_col in _x: if df_col not in cols and pd.core.common.is_numeric_dtype(_x[df_col].dtype): numeric_cols.append(df_col) def _noop(df): return df groups = _x.groupby(cols) groups.transform(_noop)Expected Output
The original input. _noop
is just a trivial example.
C:\anaconda\lib\site-packages\pandas\core\internals.py in construction_error(tot_items, block_shape, axes, e) 3968 raise ValueError("Empty data passed with indices specified.") 3969 raise ValueError("Shape of passed values is {0}, indices imply {1}".format( -> 3970 passed, implied)) 3971 3972 ValueError: Shape of passed values is (8, 25000), indices imply (8, 25799)Comments
The indices have reversed order, which is problem 1. Also, one index has lost a value.
output ofpd.show_versions()
INSTALLED VERSIONS
------------------
commit: None
python: 3.5.1.final.0
python-bits: 64
OS: Windows
OS-release: 10
machine: AMD64
processor: Intel64 Family 6 Model 94 Stepping 3, GenuineIntel
byteorder: little
LC_ALL: None
LANG: None
pandas: 0.18.1
nose: 1.3.7
pip: 8.1.2
setuptools: 23.0.0
Cython: 0.24
numpy: 1.11.0
scipy: 0.17.1
statsmodels: 0.8.0.dev0+f060948
xarray: 0.7.2
IPython: 4.2.0
sphinx: 1.3.1
patsy: 0.4.1
dateutil: 2.5.3
pytz: 2016.4
blosc: None
bottleneck: None
tables: 3.2.2
numexpr: 2.6.0
matplotlib: 1.5.1
openpyxl: None
xlrd: 1.0.0
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: None
httplib2: None
apiclient: None
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: 2.8
boto: None
pandas_datareader: 0.2.1
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4