1
$\begingroup$

I have a log-file which lists a time and date I logged in on one website. I want to create a BarChart which compares the amount of times I did it every day. How to I make Mathematica count the amount of times, when I logged in on a certain day?

$\endgroup$
1
$\begingroup$

You could use DateHistogram for this:

logs = Import["~/Downloads/dat1.csv"];
logs = Rest[logs]; (* drop the headers *)

This bit may look a bit complicated, but it's just combining the date and time strings and converting them to a DateObject, with some help about how they're formatted:

times = DateObject[{# <> " " <> #2, {"MonthShort", "DayShort", 
       "YearShort", "Hour24", "Minute"}}] & @@@ logs;

Create a histogram, with one bin for each day:

DateHistogram[times, "Day", DateTicksFormat -> {"MonthShort", "/", "Day"}]

enter image description here

$\endgroup$
0
$\begingroup$
summary = Length /@ SemanticImport["C:/temp/temp.csv"][GroupBy["Date"]]
BarChart[summary, ChartLabels -> Keys@Normal@summary,  ImageSize -> Large]

You can play with the labels as much as you wish. E.g.,

labels = DateString[#, {"MonthNameShort", "-", "Day"}] & /@ Keys@Normal@summary
BarChart[summary, ChartLabels -> labels]
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.