Skip to main content
  • Home
  • Development
  • Documentation
  • Donate
  • Operational login
  • Browse the archive

swh logo
SoftwareHeritage
Software
Heritage
Archive
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

https://github.com/lauragarrison87/DimLift
08 June 2025, 22:08:30 UTC
  • Code
  • Branches (1)
  • Releases (0)
  • Visits
    • Branches
    • Releases
    • HEAD
    • refs/heads/master
    No releases to show
  • f05882c
  • /
  • global_methods.py
Raw File Download
Take a new snapshot of a software origin

If the archived software origin currently browsed is not synchronized with its upstream version (for instance when new commits have been issued), you can explicitly request Software Heritage to take a new snapshot of it.

Use the form below to proceed. Once a request has been submitted and accepted, it will be processed as soon as possible. You can then check its processing state by visiting this dedicated page.
swh spinner

Processing "take a new snapshot" request ...

Permalinks

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • content
  • directory
  • revision
  • snapshot
origin badgecontent badge Iframe embedding
swh:1:cnt:314b012c87c79fe557e05a304724a0d0f567067d
origin badgedirectory badge Iframe embedding
swh:1:dir:f05882c6c9077b764323687cb1a380d32c00ac20
origin badgerevision badge
swh:1:rev:c67789577adfc6e6db470d86fd07fe774febfe2f
origin badgesnapshot badge
swh:1:snp:f54a274a20af8c95c14175003929ba04ae8e5b1e
Citations

This interface enables to generate software citations, provided that the root directory of browsed objects contains a citation.cff or codemeta.json file.
Select below a type of object currently browsed in order to generate citations for them.

  • content
  • directory
  • revision
  • snapshot
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Tip revision: c67789577adfc6e6db470d86fd07fe774febfe2f authored by julianemuller on 31 May 2021, 10:16:54 UTC
Merge remote-tracking branch 'origin/master'
Tip revision: c677895
global_methods.py
import pandas as pd

import global_variables as gv
import numpy as np


def fill_nan_values(df):

    df = df.fillna(df.mean())
    df = df.fillna('not defined')  # still have to be defined for correctly identified column data types

    return df.iloc[:, 0]


def get_column_id(df, name):
    if name in list(df.columns):
        return name
    else:
        if '_' in name:
            return get_column_id(df, name.rsplit('_', 1)[0])
        else:
            return False


def normalize_values(current_col_for_normalization, current_data_type, col_id):
    current_col_normalized_in_function = current_col_for_normalization

    if current_data_type == gv.id_data_type__numerical or current_data_type == gv.id_data_type__date:
        # normalize_column(current_col)
        # mean_val = current_col.mean()
        # std_val = current_col.std()

        min_val = np.amin(current_col_for_normalization)
        max_val = np.amax(current_col_for_normalization)

        normalized_values = list()

        for index_normalization in range(len(current_col_for_normalization)):
            row = current_col_for_normalization[index_normalization]

            if np.isnan(min_val):
                normalized_values.append(row)
            elif min_val == max_val:
                normalized_values.append(row)
            else:
                normalized_values.append((row - min_val) / (max_val - min_val))

        current_col_normalized_in_function = pd.Series(normalized_values)
        current_col_normalized_in_function = current_col_normalized_in_function.rename(col_id)

    return current_col_normalized_in_function

back to top

Software Heritage — Copyright (C) 2015–2025, The Software Heritage developers. License: GNU AGPLv3+.
The source code of Software Heritage itself is available on our development forge.
The source code files archived by Software Heritage are available under their own copyright and licenses.
Terms of use: Archive access, API— Contact— JavaScript license information— Web API