Hi Rashmi,
Here is one way to handle invalid values in the date column
rawData = Import["~/Downloads/sample.csv"]
(* Add column headers and convert to Dataset *)
dataset =
AssociationThread[{"Id", "Name", "Date", "Subject", "MessageId"} -> #] & /@ rawData // Dataset
(* Helper function to check if a string is convertible to DateObject *)
checkDate[date_] :=
If[Quiet@Check[DateObject[date], False] === False, False, DateObject[date]]
(* Convert Date column to DateObject where possible, filter out unconverted *)
cleanDates =
dataset[All, <|#, "Date" -> checkDate[#Date]|> &][Select[#Date =!= False &]]
Other filter examples
(* Only rows starting with "compat:" (ignoring case) in the Subject column *)
compatData =
cleanDates[Select[StringStartsQ[#Subject, "compat:", IgnoreCase -> True] &]]
(* Name is sophia *)
sophiaData = cleanDates[Select[#Name == "sophia" &]]
(* With "version" <anything> "999" in the Subject *)
v999Data =
cleanDates[Select[StringContainsQ[#Subject, ___ ~~ "version" ~~ ___ ~~ "999"] &]]
You can also use regular expressions for string matching and filtering.