Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
fanfic and stylometry
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
chrysanthopoulou
fanfic and stylometry
Commits
3b668fad
Commit
3b668fad
authored
2 years ago
by
Lea Kyveli Chrysanthopoulou
Browse files
Options
Downloads
Patches
Plain Diff
Add p_values
parent
ba1c60ba
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
delta_measure.py
+8
-0
8 additions, 0 deletions
delta_measure.py
with
8 additions
and
0 deletions
delta_measure.py
+
8
−
0
View file @
3b668fad
...
...
@@ -5,6 +5,7 @@ import pandas as pd
import
statistics
import
re
import
dataframe_image
as
dfi
import
scipy.stats
data_overview
=
pd
.
DataFrame
(
pd
.
read_csv
(
"
data_overview/data_overview.csv
"
,
index_col
=
0
))
...
...
@@ -27,6 +28,9 @@ mean_std_dev_list = [[columnName, columnData.mean(), columnData.std()] for colum
# Create a new DataFrame with the same column names and index labels as data_overview
z_scores_all_data
=
pd
.
DataFrame
(
columns
=
data_overview
.
columns
,
index
=
data_overview
.
index
)
p_values_all_data
=
pd
.
DataFrame
(
columns
=
data_overview
.
columns
,
index
=
data_overview
.
index
)
# Iterate over each cell in the data_overview DataFrame and write the corresponding z-score in the z_scores_all_data DataFrame
for
index
,
row
in
data_overview
.
iterrows
():
for
column
in
data_overview
.
columns
:
...
...
@@ -34,8 +38,12 @@ for index, row in data_overview.iterrows():
cell_value
=
data_overview
.
loc
[
index
,
column
]
z_score
=
(
cell_value
-
mean
)
/
std_dev
z_scores_all_data
.
loc
[
index
,
column
]
=
z_score
p_value
=
scipy
.
stats
.
norm
.
sf
(
abs
(
z_score
))
p_values_all_data
[
index
,
column
]
=
p_value
dfi
.
export
(
z_scores_all_data
,
"
data_overview/z_scores_all_data.png
"
,
table_conversion
=
"
matplotlib
"
)
dfi
.
export
(
p_values_all_data
,
"
data_overview/p_values_all_data.png
"
,
table_conversion
=
"
matplotlib
"
)
print
(
z_scores_all_data
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment