Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
ProcessPal
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jamal Rnjbal
ProcessPal
Merge requests
!12
17 meta data
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
17 meta data
17_meta_data
into
main
Overview
3
Commits
5
Pipelines
0
Changes
2
All threads resolved!
Show all comments
Merged
Shufei Du
requested to merge
17_meta_data
into
main
1 year ago
Overview
3
Commits
5
Pipelines
0
Changes
2
All threads resolved!
Show all comments
Expand
0
0
Merge request reports
Compare
main
version 3
f19bf377
1 year ago
version 2
bbd2c710
1 year ago
version 1
ad82f821
1 year ago
main (base)
and
latest version
latest version
8fb1a5f2
5 commits,
1 year ago
version 3
f19bf377
4 commits,
1 year ago
version 2
bbd2c710
3 commits,
1 year ago
version 1
ad82f821
2 commits,
1 year ago
2 files
+
73
−
0
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
2
Search (e.g. *.vue) (Ctrl+P)
src/group_meta_attributes.py
0 → 100644
+
25
−
0
Options
import
pandas
as
pd
"""
we want to create a function that takes a dataframe and returns another dataframe with
multiple columns {activity, {meta data columns}}
"""
class
Meta_data
:
def
__init__
(
self
,
df
:
pd
.
DataFrame
)
->
None
:
self
.
df
=
df
def
add_meta_data
(
self
)
->
pd
.
DataFrame
:
columns_all
=
self
.
df
.
columns
meta_data
=
[]
for
col
in
columns_all
:
if
col
not
in
[
"
timestamp
"
,
"
case id
"
,
"
activity
"
]:
meta_data
.
append
(
col
)
#meta_data_columns are the columns expect "timestamp" and "case_id"
#remove the case_id and timestamp columns in the dataframe
columns_all
=
[
"
activity
"
]
+
meta_data
df_new
=
self
.
df
[
columns_all
].
copy
()
# Group by the activity and get the first value for each group
aggregated_df_first
=
df_new
.
groupby
(
"
activity
"
).
first
().
reset_index
()
return
aggregated_df_first
\ No newline at end of file
Loading