Repository: mverleg/pyjson_tricks

Issue:
Pandas DeprecationWarning: .ix is deprecated

Discussion:

Patch:
diff --git a/json_tricks/encoders.py b/json_tricks/encoders.py
index 3082a8f..f6573da 100644
--- a/json_tricks/encoders.py
+++ b/json_tricks/encoders.py
@@ -316,7 +316,7 @@ def pandas_encode(obj, primitives=False):
 			))
 		repr['index'] = tuple(obj.index.values)
 		for k, name in enumerate(obj.columns.values):
-			repr[name] = tuple(obj.ix[:, k].values)
+			repr[name] = tuple(obj.iloc[:, k].values)
 		return repr
 	if isinstance(obj, Series):
 		repr = hashodict()


Test patch:
diff --git a/tests/test_pandas.py b/tests/test_pandas.py
index 4f4a89e..5c3d19c 100644
--- a/tests/test_pandas.py
+++ b/tests/test_pandas.py
@@ -24,7 +24,7 @@ def test_pandas_dataframe():
 	df = DataFrame(COLUMNS, columns=tuple(COLUMNS.keys()))
 	txt = dumps(df, allow_nan=True)
 	back = loads(txt)
-	assert isnan(back.ix[0, -1])
+	assert isnan(back.iloc[0, -1])
 	assert (df.equals(back))
 	assert (df.dtypes == back.dtypes).all()
 	df = DataFrame(COLUMNS, columns=tuple(COLUMNS.keys()))