我有一个 10 列的 df,其中的行作为单个元素列表插入。如何从所有行中删除“[]”?
我尝试过一列:df['DAT'] = df['DAT'].map(lambda x: x.replace('[]',''))
答案 0 :(得分:2)
通过 Launching lib/main.dart on Linux in debug mode...
lib/main.dart:1
[xcb] Unknown sequence number while processing queue
[xcb] Most likely this is a multi-threaded client and XInitThreads has not been called
[xcb] Aborting, sorry about that.
food_delivery: xcb_io.c:269: poll_for_event: Assertion `!xcb_xlib_threads_sequence_lost' failed.
Error waiting for a debug connection: The log reader stopped unexpectedly.
Error launching application on Linux.
Exited (sigterm)
和 flutter clean
:
astype()
或
尝试使用 strip()
和 df['DAT'] = df['DAT'].astype(str).str.strip("['']")
:
pd.eval()
答案 1 :(得分:1)
使用checkForWinX
>>> "X" == "Χ"
False
>>> "X".encode('utf-8') # this is the one you use in checkForWinX
b'X'
>>> "Χ".encode('utf-8') # this is the one you assign to mainList[row][chosenColumn]
b'\xce\xa7'