Skip to content

Commit

Permalink
summary
Browse files Browse the repository at this point in the history
  • Loading branch information
BAFurtado committed May 20, 2020
1 parent 219eaad commit 2de46d4
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions violence/plotting.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import os

import re
import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns
Expand All @@ -9,7 +9,17 @@


def summary():
pass
files = os.listdir('output/')
for file in files:
data = pd.read_csv(os.path.join('output', file), sep=';')
try:
group_col = re.findall("\['(.*)'\]", file)[0]
data = data.groupby(group_col).agg('median').reset_index()
print(data.head())
except IndexError:
num_steps = int(re.findall("_(.*).", file)[0].split('.')[0].split('_')[-1])
print(f'Número steps {num_steps}')
print(data.loc[num_steps - 1, 'Stress'])


def generic(name, ax, x_label, y_label, title, legend):
Expand Down Expand Up @@ -70,5 +80,7 @@ def another_plot(data, col_interest, col_aggregate):
# df3 = pd.read_csv('output/bundled_together.csv', sep=';')
# plot(df3, 'gender_stress', "aggressor_pct")

df = pd.read_csv('output/output_metropolis.csv', sep=';')
another_plot(df, 'aggressor_pct', 'metro')
# df = pd.read_csv('output/output_metropolis.csv', sep=';')
# another_plot(df, 'aggressor_pct', 'metro')

summary()

0 comments on commit 2de46d4

Please sign in to comment.