pandas 简易使用
笔记
pandas 学习笔记
https://github.com/xiaomiwujiecao/DataAnalysisInAction
import pandas as pd
httplog_df = pd.read_csv(csv_path, low_memory=False, encoding='utf-8')
# 查看前 5行 数据样例
print(httplog_df.head())
# 查看整个矩阵的尺寸
print(httplog_df.shape)
# http method
# bullet['attack_ip'] = row[0]
# bullet['attack_time'] = row[1]
# bullet['domain'] = row[2]
# bullet['http_method'] = row[3]
# bullet['base64_post_data'] = row[4]
# bullet['parameter'] = row[5]
# bullet['url'] = row[6]
# bullet['user_agent'] = row[7]
# bullet['cookie'] = row[8]
# bullet['x_forward_for'] = row[9]
# bullet['domain_country'] = row[10]
# bullet['domain_province'] = row[11]
# bullet['domain_city'] = row[12]
# bullet['ip_country'] = row[13]
# bullet['ip_province'] = row[14]
# bullet['ip_city'] = row[15]
# 单列去重统计
print(httplog_df['http_method'].value_counts())
print(httplog_df['ip_country'].value_counts())
Leave a Reply