Skip to content

Commit a47696a

Browse files
committed
replaced as DataFramematrix() by DataFrame.values
1 parent 2cd4281 commit a47696a

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

CHANGELOG.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
- INCOMPATIBILITY Renamed QConnection.sync and QConnection.async to
66
QConnection.sendSync and QConnection.sendAsync resp.,
77
because of 'async' becoming a keyword in Python 3.7
8+
- replaced DataFrame.as_matrix() method (deprecated since Pandas 0.23.0) by
9+
DataFrame.values
810

911
------------------------------------------------------------------------------
1012
qPython 1.3.0 [2017.03.xx]

qpython/_pandas.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ def _read_dictionary(self, qtype = QDICTIONARY):
5858

5959
return table
6060
else:
61-
keys = keys if not isinstance(keys, pandas.Series) else keys.as_matrix()
62-
values = values if not isinstance(values, pandas.Series) else values.as_matrix()
61+
keys = keys if not isinstance(keys, pandas.Series) else keys.values
62+
values = values if not isinstance(values, pandas.Series) else values.values
6363
return QDictionary(keys, values)
6464
else:
6565
return QReader._read_dictionary(self, qtype = qtype)
@@ -168,19 +168,19 @@ def _write_pandas_series(self, data, qtype = None):
168168
raise QWriterException('Unable to serialize pandas series %s' % data)
169169

170170
if qtype == QGENERAL_LIST:
171-
self._write_generic_list(data.as_matrix())
171+
self._write_generic_list(data.values)
172172
elif qtype == QCHAR:
173-
self._write_string(data.replace(numpy.nan, ' ').as_matrix().astype(numpy.string_).tostring())
173+
self._write_string(data.replace(numpy.nan, ' ').values.astype(numpy.string_).tostring())
174174
elif data.dtype.type not in (numpy.datetime64, numpy.timedelta64):
175175
data = data.fillna(QNULLMAP[-abs(qtype)][1])
176-
data = data.as_matrix()
176+
data = data.values
177177

178178
if PY_TYPE[qtype] != data.dtype:
179179
data = data.astype(PY_TYPE[qtype])
180180

181181
self._write_list(data, qtype = qtype)
182182
else:
183-
data = data.as_matrix()
183+
data = data.values
184184
data = data.astype(TEMPORAL_Q_TYPE[qtype])
185185
self._write_list(data, qtype = qtype)
186186

0 commit comments

Comments
 (0)