1 回答

TA貢獻1784條經(jīng)驗 獲得超9個贊
我已經(jīng)告訴過其他一些海報,sympy但numpy沒有整合。 sympy對象在numpy數(shù)組中工作,以至于它們可以被視為 Python 對象??雌饋硗瑯舆m用于pandas.
在一個isympy會話中,我有符號:
In [268]: tau
Out[268]: τ
In [269]: tau**2
Out[269]:
2
τ
In [270]: import pandas as pd
In [271]: S = pd.Series([tau, 1*tau, tau**2])
In [272]: S
Out[272]:
0 tau
1 tau
2 tau**2
dtype: object
In [273]: S.values
Out[273]: array([tau, tau, tau**2], dtype=object)
In [274]: [i for i in S]
Out[274]:
? 2?
?τ, τ, τ ?
In [282]: S.tolist()
Out[282]:
? 2?
?τ, τ, τ ?
系列(和數(shù)據(jù)框)將值存儲為 numpy 數(shù)組(盡可能)。請注意,數(shù)組和系列的顯示都是“普通”的。只有當我自己顯示元素時,我才能獲得格式sympy。對象 dtype 數(shù)組使用repr(i)來格式化i元素。
In [276]: print(repr(tau**2))
tau**2
添加回答
舉報