import pandas as pd import numpy as np import matplotlib.pyplot as plt
讯享网
数据导入与数据探索
数据导入
讯享网df=pd.read_csv('train_data.csv',header=None)
col_name = [ 'duration','protocol_type','service','flag','src_bytes','dst_bytes','land','wrong_fragment','urgent', 'hot','num_failed_logins','logged_in','num_compromised','root_shell','su_attempted' ,'num_root','num_file_creations','num_shells','num_access_files','num_outbound_cmds','is_hot_login','is_guest_login', 'count','srv_count','serror_rate','srv_serror_rate','rerror_rate','srv_rerror_rate','same_srv_rate' ,'diff_srv_rate','srv_diff_host_rate','dst_host_count','dst_host_srv_count','dst_host_same_srv_rate' ,'dst_host_diff_srv_rate','dst_host_same_src_port_rate','dst_host_srv_diff_host_rate','dst_host_serror_rate' ,'dst_host_srv_serror_rate','dst_host_rerror_rate','dst_host_srv_rerror_rate','target' ]
讯享网# 将列名添加到df中 df.columns=col_name
数据查看
df.info()
讯享网<class 'pandas.core.frame.DataFrame'> RangeIndex: entries, 0 to Data columns (total 42 columns): duration int64 protocol_type object service object flag object src_bytes int64 dst_bytes int64 land int64 wrong_fragment int64 urgent int64 hot int64 num_failed_logins int64 logged_in int64 num_compromised int64 root_shell int64 su_attempted int64 num_root int64 num_file_creations int64 num_shells int64 num_access_files int64 num_outbound_cmds int64 is_hot_login int64 is_guest_login int64 count int64 srv_count int64 serror_rate float64 srv_serror_rate float64 rerror_rate float64 srv_rerror_rate float64 same_srv_rate float64 diff_srv_rate float64 srv_diff_host_rate float64 dst_host_count int64 dst_host_srv_count int64 dst_host_same_srv_rate float64 dst_host_diff_srv_rate float64 dst_host_same_src_port_rate float64 dst_host_srv_diff_host_rate float64 dst_host_serror_rate float64 dst_host_srv_serror_rate float64 dst_host_rerror_rate float64 dst_host_srv_rerror_rate float64 target object dtypes: float64(15), int64(23), object(4) memory usage: 1.5+ GB
df.describe().T

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容,请联系我们,一经查实,本站将立刻删除。
如需转载请保留出处:https://51itzy.com/kjqy/22896.html