我有下面的代码可以用,但它会抛出一些
UserWarning
打印数据时..
import pandas as pd
pd.set_option('display.height', None)
pd.set_option('display.max_rows', None)
pd.set_option('display.max_columns', None)
pd.set_option('display.width', None)
pd.set_option('expand_frame_repr', True)
data = pd.read_csv('/home/karn/plura/Test/Python_Pnada/Cyber_July.csv', usecols=['Platform ID', 'Safe', 'Target system address', 'Failure reason'])
hostData = data[data['Platform ID'].str.startswith("CS-Unix-")][data['Safe'].str.startswith("CS-NOI-DEFAULT-UNIX-ROOT")] [['Platform ID', 'Safe', 'Target system address','Failure reason']]
hostData.reset_index(level=0, drop=True)
print(hostData)
下面是用户警告。
./CyberCSV.py:12: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
hostData = data[data['Platform ID'].str.startswith("CS-Unix-")][data['Safe'].str.startswith("CS-NOI-DEFAULT-UNIX-ROOT")] [['Platform ID', 'Safe', 'Target system address','Failure reason']]
第二,有没有一种方法可以像我一样在数据帧中使用通配符?
data['Safe'].str.startswith("CDS-NOI-DEFAULT-UNIX-ROOT")
我想用的地方
data['Safe'].str.startswith("CDS-*DEFAULT-UNIX-ROOT")
这有可能吗?