A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/pandas-dev/pandas/issues/15370 below:

deepcopy failure on empty dataframes with non-empty column set (numpy 1.12 compatibility) · Issue #15370 · pandas-dev/pandas · GitHub

Code Sample, a copy-pastable example if possible
# Your code here
import pandas as pd
import copy

# This one works
df = pd.DataFrame(data=[], index=[])
df_copy = copy.deepcopy(df)

# This one fails
df2 = pd.DataFrame(data=[], index=[], columns=['a'])
df2_copy = copy.deepcopy(df2)
Problem description

This only occurs with numpy 1.12 (and, presumably above): when deepcopying an empty dataframe with a non-empty column set, it fails with the following:

ValueError: Iteration of zero-sized operands is not enabled

If the column set is also empty, everything works as expected.

On older numpy versions (1.11), it also works as expected.

Expected Output

Not failing.

Output of pd.show_versions() # Paste the output here pd.show_versions() here INSTALLED VERSIONS ------------------ commit: None python: 3.4.0.final.0 python-bits: 64 OS: Linux OS-release: 4.4.0-62-generic machine: x86_64 processor: x86_64 byteorder: little LC_ALL: None LANG: en_US.UTF-8 LOCALE: en_US.UTF-8

pandas: 0.19.2
nose: 1.3.7
pip: 9.0.1
setuptools: 32.3.1.post20170108
Cython: 0.25.2
numpy: 1.12.0
scipy: 0.18.1
statsmodels: None
xarray: None
IPython: 5.1.0
sphinx: None
patsy: None
dateutil: 2.6.0
pytz: 2016.10
blosc: None
bottleneck: None
tables: None
numexpr: None
matplotlib: 2.0.0
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: None
httplib2: None
apiclient: None
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: None
boto: None
pandas_datareader: None


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