Posts

Showing posts from October, 2024

Pandas in Python - Part 2

Image
 There are several ways to filter records in Pandas. Boolean Indexing query() method loc attribute where() method import pandas as pd C_attack = pd . read_csv ( "C:\Cybersecurity\cybersecurity_attacks.csv" ) C_attack C_attack_New = C_attack [ C_attack [ "Protocol" ] == "UDP" ] C_attack . size C_attack_New . size C_attack_New Query_String = 'Protocol  !=  "UDP"' C_attack . query ( Query_String ) C_attack . where ( C_attack [ "Packet Length" ] > 1000 ) C_attack . loc ( C_attack [ "Packet Length" ] > 1000 )

Pandas in Python .. Part 1

Image
Pandas in Python - Part 1 Pandas is a powerful Python library for data analysis and manipulation. It started in 2008 and provides data structures like DataFrames and Series, similar to spreadsheets and arrays mainly tabular data. Key features include: Data loading Data cleaning Data manipulation Data analysis Integration with other libraries Pandas has become an essential tool for data scientists, analysts, and researchers due to its efficiency, flexibility, and extensive capabilities. C_attack . columns C_attack . info () C_attack [ "Protocol" ] print ( C_attack . shape ) print ( C_attack .flags) print ( C_attack . size )