Skip to content

Commit

Permalink
replaced as DataFramematrix() by DataFrame.values
Browse files Browse the repository at this point in the history
  • Loading branch information
SKolodynski committed Dec 26, 2018
1 parent 2cd4281 commit a47696a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
- INCOMPATIBILITY Renamed QConnection.sync and QConnection.async to
QConnection.sendSync and QConnection.sendAsync resp.,
because of 'async' becoming a keyword in Python 3.7
- replaced DataFrame.as_matrix() method (deprecated since Pandas 0.23.0) by
DataFrame.values

------------------------------------------------------------------------------
qPython 1.3.0 [2017.03.xx]
Expand Down
12 changes: 6 additions & 6 deletions qpython/_pandas.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ def _read_dictionary(self, qtype = QDICTIONARY):

return table
else:
keys = keys if not isinstance(keys, pandas.Series) else keys.as_matrix()
values = values if not isinstance(values, pandas.Series) else values.as_matrix()
keys = keys if not isinstance(keys, pandas.Series) else keys.values
values = values if not isinstance(values, pandas.Series) else values.values
return QDictionary(keys, values)
else:
return QReader._read_dictionary(self, qtype = qtype)
Expand Down Expand Up @@ -168,19 +168,19 @@ def _write_pandas_series(self, data, qtype = None):
raise QWriterException('Unable to serialize pandas series %s' % data)

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

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

self._write_list(data, qtype = qtype)
else:
data = data.as_matrix()
data = data.values
data = data.astype(TEMPORAL_Q_TYPE[qtype])
self._write_list(data, qtype = qtype)

Expand Down

0 comments on commit a47696a

Please sign in to comment.