MCPcopy Create free account
hub / github.com/numpy/numpy / cast

Method cast

numpy/polynomial/_polybase.py:1167–1206  ·  view source on GitHub ↗

Convert series to series of this class. The `series` is expected to be an instance of some polynomial series of one of the types supported by by the numpy.polynomial module, but could be some other class that supports the convert method. .. versionadded:: 1.

(cls, series, domain=None, window=None)

Source from the content-addressed store, hash-verified

1165
1166 @classmethod
1167 def cast(cls, series, domain=None, window=None):
1168 """Convert series to series of this class.
1169
1170 The `series` is expected to be an instance of some polynomial
1171 series of one of the types supported by by the numpy.polynomial
1172 module, but could be some other class that supports the convert
1173 method.
1174
1175 .. versionadded:: 1.7.0
1176
1177 Parameters
1178 ----------
1179 series : series
1180 The series instance to be converted.
1181 domain : {None, array_like}, optional
1182 If given, the array must be of the form ``[beg, end]``, where
1183 ``beg`` and ``end`` are the endpoints of the domain. If None is
1184 given then the class domain is used. The default is None.
1185 window : {None, array_like}, optional
1186 If given, the resulting array must be if the form
1187 ``[beg, end]``, where ``beg`` and ``end`` are the endpoints of
1188 the window. If None is given then the class window is used. The
1189 default is None.
1190
1191 Returns
1192 -------
1193 new_series : series
1194 A series of the same kind as the calling class and equal to
1195 `series` when evaluated.
1196
1197 See Also
1198 --------
1199 convert : similar instance method
1200
1201 """
1202 if domain is None:
1203 domain = cls.domain
1204 if window is None:
1205 window = cls.window
1206 return series.convert(domain, cls, window)

Callers 4

test_castFunction · 0.45
test_fromrootsFunction · 0.45
test_integFunction · 0.45
test_callFunction · 0.45

Calls 1

convertMethod · 0.80

Tested by 4

test_castFunction · 0.36
test_fromrootsFunction · 0.36
test_integFunction · 0.36
test_callFunction · 0.36