content stringlengths 42 6.51k |
|---|
def get_circular(
locus_text: str) -> bool:
"""
Args:
locus_text:
The LOCUS (i.e. header section) of genbank file
"""
line1 = locus_text[:locus_text.find('\n')]
if ' circular ' in line1: return True
return False |
def transform_color(color1, color2, skipR=1, skipG=1, skipB=1):
"""
transform_color(color1, color2, skipR=1, skipG=1, skipB=1)
This function takes 2 color1 and color2 RGB color arguments, and then returns a
list of colors in-between the color1 and color2
eg- tj.transform_color([0,0,0],[10,10,20]) returns a list:... |
def parse_style(style_string: str) -> dict:
"""[summary]
Args:
style_string (str): [description]
Returns:
dict: [description]
"""
return {kv.split(':')[0]:int(kv.split(':')[1]) if kv.split(':')[1].isdigit() else kv.split(':')[1] for kv in style_string.split(';')} |
def expand_locations(ctx, values, targets = []):
"""Expands the `$(location)` placeholders in each of the given values.
Args:
ctx: The rule context.
values: A list of strings, which may contain `$(location)` placeholders.
targets: A list of additional targets (other than the calling rul... |
def not_(x):
"""Support `not x` syntax"""
if bool(x):
return False
return True |
def get_chromosome_number(chrom: str) -> int:
"""
Get chromosome number (index) of the supplied chromosome:
'1' -> 1, chr1 -> 1, returns -1 when not available, chrM -> -1
"""
try:
return int(chrom.replace('chr',''))
except Exception as e:
return -1 |
def _get_time_split(timing_line):
"""Extracts timing information from a boost-formatted timestamp, i.e.:
<timestamp> GeometricCalibration.cpp:<line_number> Aggregate timing: <wall>s wall, <user>s user + <system>s system = <cpu>s CPU (<pct>%)
Args:
timing_line (str): Line of the above format.
... |
def groupBy(keyFn, row_data):
"""Group rows in row_data by the result of keyFn.
Arguments:
keyFn -- A function that returns the cell data of the column to group by.
Needs to be tailored to the structure of row_data.
row_data -- A table organized as a list of row data structures.
Retur... |
def get_prob(date):
"""get the file name of the probability"""
date = str(date)
ret = date + 'prob.csv'
return ret |
def connect_(pairs, n=1):
"""connect_
Connects two adjacent clusters if their distance is <= n
:param pairs: Clusters of iterateables e.g., [(1,5),(7,10)]
:param n: distance between two clusters
"""
if len(pairs) == 0:
return []
start_, end_ = pairs[0]
new_pairs = []
for i,... |
def _hashable_bytes(data):
"""
Coerce strings to hashable bytes.
"""
if isinstance(data, bytes):
return data
elif isinstance(data, str):
return data.encode('ascii') # Fail on anything non-ASCII.
else:
raise TypeError(data) |
def parse_directions(input_directions):
"""Parse input_directions for single tile from str to list of str."""
directions = []
index = 0
while index != len(input_directions):
left = input_directions[index:]
if left.startswith('s') or left.startswith('n'):
directions.append(lef... |
def header_from_line(line):
"""
Parse a tsv header
:param line: the header text
:return: (column_names list, column_indices dict)
"""
if len(line) == 0:
return [], {}
column_names = line.rstrip("\n").split("\t")
column_indices = dict([(name, index) for index, name in enumerate(column_names)])
return colum... |
def sortable_label(label, separator='-'):
""" Create a sortable tuple out of a label.
Converts a dashed label into a tuple based on the following rules:
- If a segment is numeric, it will get three leading zero places
- If a segment is alphabetic and is already uppercase, it is
retur... |
def wrap_text(text, font, width):
# ColdrickSotK
# https://github.com/ColdrickSotK/yamlui/blob/master/yamlui/util.py#L82-L143
"""Wrap text to fit inside a given width when rendered.
:param text: The text to be wrapped.
:param font: The font the text will be rendered in.
:param width: The width t... |
def is_pangram(s):
"""Return True if str `s` is a pangram, False otherwise
>>> is_pangram("The quick brown fox jumped over the lazy dog.')
True
>>> is_pangram("The slow brown fox jumped over the lazy dog.')
False
"""
return len(set([c for c in s.lower() if 'a' <= c <= 'z'])) == 26 |
def reverse_linked_list_recursive(head):
"""Excercise 1.3.30 Recursively reverese a linked list."""
if head is None:
return
if head.next is None:
return head
second = head.next
rest = reverse_linked_list_recursive(second)
second.next = head
head.next = None
return rest |
def round_nearest(value, multiple_of):
"""round to `multiple_of` value.
based on: https://stackoverflow.com/a/28425782/574981
"""
return round(value / multiple_of) * multiple_of |
def zero2minimum(single_data):
"""change the value which is zero into 0.0000001
:param single_data: data point
:return: data which may be 0.0000001
"""
single_data = 0.0000001 if single_data == 0 else single_data
return single_data |
def trimText(message):
"""
This functions cleans the string
It removes all the characters without A-Z, a-z
:param message: The string which I want to trim
:return: returns a string
"""
trimmed_text = []
for i in range(len(message)):
if 'A' <= message[i] <= 'Z' or 'a' <= message[i... |
def _get_gl_version(_lib):
"""Helper to get the GL version string"""
try:
return _lib.glGetString(7938).decode('utf-8')
except Exception:
return 'unknown' |
def program_counter(c):
"""program counter"""
v = "c.pc"
return v |
def divide_dict(a_dict, divide_func):
"""Divide a dict like object into two parts.
- a_dict: dict like object
- divide_func: the divide function to return True/False
Return two parts of the dict.
Example:
divide({'a': 1, 'b': 2}, lambda k, v: v > 1) -> {'b': 2}, {'a': 1}
"""
suit,... |
def is_good_candidate(input_string, guess_word):
"""
input_string: string, the user input to be spellchecked
guess_word: string, the word from the wordlist to be checked for candidacy
returns: bool, True if the guess is of good length and the beginnings and
endings of both of the strings match up co... |
def check_for_repeats(string):
"""
Returns a tuple of booleans, the first if duplicates exist, the second if triples do.
"""
double = False
triple = False
counts = {}
for c in sorted(string):
if c in counts:
counts[c] += 1
else:
counts[c] ... |
def normalize(value: float, min_value: float, max_value: float) -> float:
"""Normalize value to range [0..1]"""
if min_value == max_value:
return 0
if not min_value <= value <= max_value:
raise ValueError(f"Value {value} is not in range [{min_value}; {max_value}]")
return (value - min_va... |
def get_adjacents(row, col, max_row, max_col):
"""
Obtains the directions of the adjacent spaces
"""
result = []
up_row = row - 1
left_col = col - 1
down_row = row + 1
right_col = col + 1
if up_row >= 0:
result.append((up_row, col))
if left_col >= 0:
result.append... |
def get_disabled_vhost_path(version, domain):
"""
Get the path for a disabled PHP vhost file regardless of wether or not it exists.
Args:
version - The PHP version used in the file path
domain - The domain used in the file path
"""
return '/opt/php-' + version + '/etc/php-fpm.d/' + ... |
def _add_algorithm_defaults(algorithm):
"""Central location specifying defaults for algorithm inputs.
Converts allowed multiple inputs into lists if specified as a single item.
"""
defaults = {"archive": [],
"min_allele_fraction": 10.0,
"tools_off": []}
convert_to_li... |
def compute_cycle_length_with_denom(denom):
"""
Compute the decimal cycle length for unit fraction 1/denom (where denom>1)
e.g. 1/6 has decimal representation 0.1(6) so cycle length is 1, etc
"""
digit_pos = 0
# Remaining fraction after subtracting away portions of earlier decimal digits
fr... |
def get_contiguous_pairs(sequence: list, pair_size: int) -> list:
""""
DOCTEST
>>> get_contiguous_pairs(sequence=[1, 2, 3, 4], pair_size=2)
[[1, 2], [2, 3], [3, 4]]
>>> get_contiguous_pairs(sequence=[1, 2, 3, 4], pair_size=3)
[[1, 2, 3], [2, 3, 4]]
"""
return [sequence[i:i + pair_size] ... |
def coulomb_force(q1, q2, r):
"""
Calculates the force between two point charges.
Applying coulombs law of F = k * q_1 * q_2 / r ** 2 to find the force of attraction/repulsion between two charges
based on their distance from each other.
:param q1: Scalar: Charge given in Coulombs
:param q2: Sc... |
def format_tuple(tup, join_char="."):
"""Formats a tuple of Version numbers for printing.
Example:
(4, 2, 0) turns into 4.2.0
Args:
tup (tuple): Version as tuple.
join_char (char): Character by which numbers are joined (default: ".")
Returns:
str: Joined version number.
... |
def rk4(x, v, t, h, deriv):
"""
Core Rk4 algo for calculating one step ahead.
This version is limited to 2nd order eq's of the type
dx^2/dt^2 + p(t,x,v)*dx/dt + q(t,x,v)*x = r(t,x,v)
Input:
- x: x (t)
- v: v (t)
- t: Initial time (t_n)
- h: Stepsize (t_{n+1} = t_... |
def c3_merge(bases):
""" Merge together the list of base classes into the mro that will be
created using the C3 linearisation algorithm
"""
# Protect against empty base class lists (although this should never happens
# because everyone derives from object *right*?)
if not bases:
retu... |
def fetchPID( pid ):
""" Read in the HST visit status page for the given program ID.
"""
import sys
try:
from bs4 import BeautifulSoup as bs
except ImportError :
print("Error: hstMonitor requires BeautifulSoup4.")
print(" http://www.crummy.com/software/BeautifulSoup")... |
def process(proc_data):
"""
Final processing to conform to the schema.
Parameters:
proc_data: (dictionary) raw structured data to process
Returns:
List of dictionaries. Each dictionary represents a row in the csv file:
[
{
csv file converted to a Dict... |
def _stringify_na_values(na_values):
""" return a stringified and numeric for these values """
result = []
for x in na_values:
result.append(str(x))
result.append(x)
try:
v = float(x)
# we are like 999 here
if v == int(v):
v = int(... |
def rivers_with_station(stations):
"""Returns a list containing the names of all the rivers that have at least one of the stations provided as input"""
# Add the rivers of all stations to a set so they are not repeated.
rivers = set()
for station in stations:
rivers.add(station.river)
# Re... |
def distance_to_buckets(d):
"""converts distance to one-hot vector"""
ohe = [0] * 10
if d == 0:
ohe[0] = 1
elif d == 1:
ohe[1] = 1
elif d == 2:
ohe[2] = 1
elif d == 3:
ohe[3] = 1
elif d == 4:
ohe[4] = 1
elif 5 <= d < 8:
ohe[5] = 1
elif ... |
def extract_keys(inp_dict, keys):
"""
Return dictionary witxh selected keys
:param inp_dict: dictionary
:param keys: list or string
:return: dictionary
"""
if not isinstance(keys, list):
keys = [keys]
return {your_key: inp_dict[your_key] for your_key in keys} |
def get_mips_per_model(models_and_mips, cmip6_model):
"""
Identifies the mips for that specific model input.
:param models_and_mips:
:param cmip6_model:
:return: mips
"""
for model, mips in models_and_mips.items():
if model == cmip6_model:
return mips
raise Excepti... |
def pair_gcd(a,b):
"""Return greatest common divisor using Euclid's Algorithm."""
while b:
a, b = b, a % b
return a |
def get_task_name(request, default):
"""Use 'shadow' in request for the task name if applicable."""
# request.shadow could be None or an empty string.
# If so, we should use default.
return getattr(request, 'shadow', None) or default |
def split_network_line(line):
"""Parses line of /proc/virtual/<xid>/cacct for network usage.
The cacct file has a header followed by usage counts for multiple protocols.
Header (provided for context):
Type recv #/bytes send #/bytes fail #/bytes
Each protocol's usage counts are formatte... |
def str_to_positive_int(text):
""" Convert a string representation back to PositiveInt.
"""
if text.strip():
val = int(text)
if val >= 0.:
return int(text)
else:
raise ValueError("Value should be positive.")
else:
return 0 |
def significant_magnitude(num):
""" Return an integer of -1, 0, or 1 based on magnitude with an arbitrary
significance of 0.07 """
if -0.08 < num < 0.08:
return False
return True |
def get_public_STATE_transitions(self, field="state"):
"""
Returns the transitions which are meant to be seen by the customer.
The admin on the other hand should be able to see everything.
:param str field: the name of the :class:`~django_states.fields.StateField`
"""
if getattr(self, "_%s_log_... |
def join_deps(deps, commasep=True):
"""
Take the result from explode_dep_versions and generate a dependency string
"""
result = []
for dep in deps:
if deps[dep]:
if isinstance(deps[dep], list):
for v in deps[dep]:
result.append(dep + " (" + v +... |
def is_overlapped(end1, start2):
"""Returns True if segments are overlapping.
Arguments
---------
end1 : float
End time of the first segment.
start2 : float
Start time of the second segment.
Returns
-------
overlapped : bool
True of segments overlapped else Fals... |
def search4vowels(phrase: str) -> set:
"""Returns the set of vowels found in 'phrase'."""
return set('aeiou').intersection(set(phrase)) |
def excel_column_name(n):
"""Number to Excel-style column name, e.g., 1 = A, 26 = Z, 27 = AA, 703 = AAA."""
name = ''
while n > 0:
n, r = divmod (n - 1, 26)
name = chr(r + ord('A')) + name
return name |
def remove_index(a, index):
"""Remove element at index of a sequence and return it as a list"""
a = list(a)
a.pop(index)
return a |
def _CompareLocaleLists(list_a, list_expected, list_name):
"""Compare two lists of locale names. Print errors if they differ.
Args:
list_a: First list of locales.
list_expected: Second list of locales, as expected.
list_name: Name of list printed in error messages.
Returns:
On success, return Fal... |
def hex_to_rgb(hex_color):
"""
Converts a 6 digit hex number to RGB.
@param: hex_color - A 6 digit string with values in the range [a-fA-F0-9].
@return: a tuple containing 3 integers.
"""
if not isinstance(hex_color, str):
raise TypeError("'hex_color' must be of type 'str'.")
if le... |
def factorize(n):
"""Returns list of prime factors of positive integer n."""
i = 2
factors = []
while True:
q, r = divmod(n, i)
if r:
i += 1
if i > n:
return factors
else:
factors.append(i)
if q < i:
... |
def date_span_intersection(date_span_1, date_span_2):
"""Return a tuple of dates representing the overlap between `date_span_1`
and `date_span_2`. If the date spans do not overlap, return `None`.
"""
intersection_first_date = max(date_span_1[0], date_span_2[0])
intersection_second_date = min(date_s... |
def lr_schedule(epoch: int, lr: float):
"""
Scheduler function for keras callback.
:param epoch: Epoch number.
:param lr: Initial learning rate.
:return: Updated LR.
"""
if epoch < 40:
lr_ = lr
elif epoch < 60:
lr_ = lr / 3
elif epoch < 70:
lr_ = lr / 5
el... |
def average(a, b):
"""
:param a: int, sum of total value
:param b: int, the amount of temp information
:return: a / b
"""
avg = a / b
return avg |
def validate_target_port(value):
"""Raise exception if target port fails to match length constraint."""
if value and value["Port"] > 65535:
return "have value less than or equal to 65535"
return "" |
def s2n(s):
"""
s2n(string) -> int
String to Number
"""
return int(s.encode('hex'),16) if len(s) else 0 |
def getScriptName(programName):
"""
Splits a given string suspected to be a file name and returns the prefix with out the file extension.
Args:
programName: String file name candidate.
Returns: prefix of file.
"""
# Script name
scriptName = programName.split('.')[0].upper()... |
def dict_access(d, key):
"""Access a key in a dict using . notation (key.subkey1.subkey2...subkeyn)
returns None if the key path does not exist in the object"""
current = d
for subkey in key.split("."):
try:
current = current[subkey]
except KeyError:
return None
... |
def findXDeltaFromDirection(direction):
""" Returns delta X for jumping, when given a direction value """
if direction in (2, 4):
return 2
elif direction in (6, 8):
return -2
else:
error_template = "Unexpected direction value of: {0}"
raise ValueError(error_template.forma... |
def single_line(value):
"""Returns the given string joined to a single line and trimmed."""
return " ".join(filter(None, map(str.strip, value.splitlines()))) |
def decompose_code(code):
"""
Decomposes a MARC "code" into tag, ind1, ind2, subcode
"""
code = "%-6s" % code
ind1 = code[3:4]
if ind1 == " ": ind1 = "_"
ind2 = code[4:5]
if ind2 == " ": ind2 = "_"
subcode = code[5:6]
if subcode == " ": subcode = None
return (code[0:3], ind1,... |
def get_sh_resource_type(iot_finding):
"""Return ASFF Resource type based on IoT Device Defender finding"""
return "AwsIamRole" if iot_finding['nonCompliantResource']['resourceType'] == "IAM_ROLE" else "Other" |
def camel_to_snake(word: str, depublicize: bool = False):
"""Convert came case to snake case."""
word = "".join(["_" + i.lower() if i.isupper() else i for i in word])
if not depublicize:
word = word.lstrip("_")
return word |
def rankine2kelvin(K):
"""
Convert Rankine Temperature to Kelvin
:param K: Temperature in K Kelvin
:return: Temperature in R Rankine
"""
return 5.0 / 9.0 * K |
def getBucketName(year, month, day, radar):
""" Get the name of a specific bucket where radar data is stored.
Args:
year: Year as an integer.
month: Month as an integer.
day: Day as an integer.
radar: The 4 letter name of the radar, a string.
Returns:
The bucket nam... |
def calc_results_progress(
number_of_users: int,
number_of_users_required: int,
cum_number_of_users: int,
number_of_tasks: int,
number_of_results: int,
) -> int:
"""
for each project the progress is calculated
not all results are considered when calculating the progress
if the requir... |
def cube(number):
""" Returns True if number is cube """
if number == 1:
return True
root = round(number ** (1. / 3))
return root**3 == number |
def get_next_run_id(root, scheme_entry):
"""Cycles through a root object to get the next unique run_id string for a new measurement"""
i = 1
while True:
run_id = 'run_' + str(i)
try:
existing_weighing = root['Circular Weighings'][scheme_entry]['measurement_' + run_id]
... |
def cmd_if(ctx, cond, true_block, false_block=None):
"""
It returns true block if condition occur
"""
return true_block if cond else false_block or [] |
def CheckForExistence(requested_data, available_data):
"""Determine whether the requested data exists.
Args:
requested_data: The specific data being requested.
available_data: The full set of available data to tell whether it is just
the requested data that does not exist, or no data exists at all.... |
def raise_to_list(input):
"""
This will take an input and raise it to a List (if applicable). It will preserve None values as None.
Parameters
----------
input : object
The object to raise to a list.
Returns
-------
list
The object as a list, or None.
"""
if inp... |
def list_union(start_list, then_include) -> None:
"""
This method ensures an output that includes everything from both lists
"""
if type(then_include) is str:
if then_include not in start_list:
start_list.append(then_include)
elif type(then_include) is list:
for item in t... |
def compress_data(data):
"""Remove all keys from ``data`` that refer to themselves::
>>> data = {'a': 'a', 'b': 'c'}
>>> compress_data(data)
{'b': 'c'}
"""
compressed = {}
for k, v in data.items():
if not k == v:
compressed[k] = v
r... |
def byte_to_signed_int(x):
"""
Returns a signed integer from the byte
:param x: Byte
"""
if (x & 0x80) >> 7 == 1:
return -((x-1) ^ 0xff)
else:
return x |
def format72(value):
"""
Adapt string to fit on a 72 line
@param value (string) The string to adapt
@param (string) The updated string
"""
val72 = ''
for i in range(int(len(value)/71)+1):
val72 = val72 + (value+71*' ')[71*i:71*i+71] + '\n'
return val72.rstrip() |
def replace_variables_in_text(function_with_text, variables):
""" Perform variable replacement in text """
return function_with_text.__doc__.format(**variables) |
def cleanup_salary(row):
"""to clean salary to replace $ sign """
salary = row["Salary"].replace("$", "")
salary = float(salary)
return salary |
def to_reduced_row_echelon_form(matrix):
"""
This method computes the reduced row echelon form (a.k.a. row canonical
form) of a matrix. The code is taken from
https://rosettacode.org/wiki/Reduced_row_echelon_form#Python and edited with
minor changes.
:param matrix matrix: matrix to be ... |
def indent(text, numtabs=1, spacespertab=4, tab=None):
"""
Indents a given multiline string.
By default, indentation is done using spaces rather than tab characters.
To use tab characters, specify the tab character explictly, e.g.::
indent(text, tab='\t')
Note that in this... |
def remove_item(thislist, item):
"""
Remove item from list without complaining if absent
@param thislist : list of items
@param item : item which may or may not be in the list
@return: reduced list
"""
try:
thislist.remove(item)
except ValueError:
pass
return thislist |
def readgenefile(genefile):
""" Get the gene list """
success = False
try:
with open(str(genefile), 'r') as f:
lines = [line.rstrip('\n').split(',') for line in f]
genes = [line[0] for line in lines]
linkers = [line[1:] for line in lines]
success = Tru... |
def is_2numbers(astring):
"""
(str) -> Boolean
returns True if astring has at least two numbers.
else return False.
>>> is_2numbers('CIS122')
True
>>> is_2numbers('Ducks')
False
>>> is_2numbers('ABC-1')
False
"""
digits_ctr = 0
for c in astring:
if c.is... |
def left_remove(text, to_remove):
""" Removes a part of a string, if it starts with it.
Similar to str.lstrip, see note below on right_remove
"""
if text.startswith(to_remove):
return text.replace(to_remove, '', 1)
else:
return text |
def get_engagement_rate_max(selectpicker_id: str) -> int:
"""
Max-Delegate-target of get_engagement_rates_min_max (dac-pattern)
:param selectpicker_id:
:return: int -> max-value of engagement-rate
"""
max_values = {
"1": 1,
"2": 2,
"3": 3,
"4": 4,
"5": 5,... |
def format_author_ed(citation_elements):
"""Standardise to (ed.) and (eds.)
e.g. Remove extra space in (ed. )
"""
for el in citation_elements:
if el['type'] == 'AUTH':
el['auth_txt'] = el['auth_txt'].replace('(ed. )', '(ed.)')
el['auth_txt'] = el['auth_txt'].replace('(ed... |
def make_dict_from_tree(element_tree):
"""Traverse the given XML element tree to convert it into a dictionary.
:param element_tree: An XML element tree
:type element_tree: xml.etree.ElementTree
:rtype: dict
"""
def internal_iter(tree, accum):
"""Recursively iterate through the elements... |
def str2int(val):
"""
Converts a decimal or hex string into an int.
Also accepts an int and returns it unchanged.
"""
if type(val) is int:
return int(val)
if len(val) < 3:
return int(val, 10)
if val[:2] == '0x':
return int(val, 16)
return int(val, 10) |
def assign_rank_group(atom_num, assign, rank, rank_num):
"""
|
**Description:** Assign rank to each group
**Input:**
- atom_num: Atom respectively which we are producing the rank from
- assign: Group of molecules grouped on clusters dependiong on the ligand connectivity
- rank: list o... |
def sanitise(dic):
"""Adds underscores to keys in dictionary"""
new_dic = dict()
for key, value in dic.items():
new_dic["_{}".format(key)] = value
return new_dic |
def mutual_information_calc(response_entropy, conditional_entropy):
"""
Calculate Mutual information.
:param response_entropy: response entropy
:type response_entropy: float
:param conditional_entropy: conditional entropy
:type conditional_entropy: float
:return: mutual information as float... |
def is_full_connected (v: int, r: int) -> bool:
"""
This function checks if graph is full connected.
:param v: number of nodes graph has
:param r: number of edges graph has
:return: True if all nodes are connected, otherwise False
:example:
>>> is_full_connected(0, 1)
False
>>> is... |
def _create_tree_from_edges(edges):
"""
Examples
--------
>>> from pprint import pprint
>>> pprint(_create_tree_from_edges([[1,2],[0,1],[2,3],[8,9],[0,3]]))
{0: [1, 3], 1: [2, 0], 2: [1, 3], 3: [2, 0], 8: [9], 9: [8]}
Parameters
----------
edges : list of pairs
"""
tree = ... |
def _is_spec_data(spec, spectype):
"""
Checks to see if the spec is data only
Args:
spec: to check
spectype: if any available
Returns:
true if only data, false if it is a spec
"""
if spec == 'nested' or spectype == 'nested':
return False
# if it is not a dic... |
def _prepare_toc(toc):
"""Prepare the TOC for processing."""
# Un-nest the TOC so it's a flat list
new_toc = []
for chapter in toc:
sections = chapter.get('sections', [])
new_toc.append(chapter)
for section in sections:
subsections = section.get('subsections', [])
... |
def smart_rename(dic):
"""
assign MW in MDa or KDa depending on the string
"""
for k in dic:
if len(dic[k].split(".")[0]) > 6:
dic[k] = str(round(float(dic[k]) / 1000000, 2)) + " MDa"
else:
dic[k] = str(round(float(dic[k]) / 1000, 2)) + " KDa"
return dic |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.