所以我有这个数据框:
dfprices = pd.DataFrame(价格)
pd.Dataframe = (
price symbol
0 0.10566500 ETHBTC
1 0.01643000 LTCBTC
2 0.00112080 BNBBTC
3 0.01423200 NEOBTC
4 0.00030000 123456
5 0.03393500 QTUMETH
6 0.01077400 EOSETH
7 0.00022600 SNTETH
8 0.00630600 BNTETH
9 0.14548000 BCCBTC
10 0.00599900 GASBTC
11 0.01059800 BNBETH
12 10294.77000000 BTCUSDT
13 1089.99000000 ETHUSDT
14 0.00142500 HSRBTC )
从此我想
为此,我使用了以下代码:
dfcleanprices = dfprices[dfprices['symbol'].str[-3:]=="BTC"]
dfcleanprices['symbol'] = dfcleanprices['symbol'].str[:-3]
我想要的结果是:
pd.Dataframe = (
price symbol
0 0.10566500 ETH
1 0.01643000 LTC
2 0.00112080 BNB
3 0.01423200 NEO
9 0.14548000 BCC
10 0.00599900 GAS
14 0.00142500 HSR
19 0.00105000 MCO
20 0.00324080 WTC
22 0.00009404 LRC
24 0.00358700 QTUM)
但是通过执行第二个语句会显示警告:
SettingWithCopyWarning:
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead
See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
from binance.client import Client
我尝试了很多,但我真的需要帮助:)