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/6733 below:

groupby looses dtype on empty columns · Issue #6733 · pandas-dev/pandas · GitHub

In this snippet:

import pandas as pd
import numpy as np

print 'numpy', np.__version__
print 'pandas', pd.__version__

df = pd.DataFrame({'x': [],'range': np.arange(0)})

t = df.sort('x').groupby('x').first()

print 'types', df['range'].dtype, t['range'].dtype

it is shown that after the groupby, an empty "int" column becomes an empty "float". This is the output on my machine:

numpy 1.6.2
pandas 0.13.1
types int32 float64

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