_id
stringlengths 2
6
| partition
stringclasses 3
values | text
stringlengths 87
6.4k
| title
stringclasses 1
value | language
stringclasses 1
value | meta_information
dict |
---|---|---|---|---|---|
d20601
|
test
|
def clean_column_names(df: DataFrame) -> DataFrame:
"""
Strip the whitespace from all column names in the given DataFrame
and return the result.
"""
f = df.copy()
f.columns = [col.strip() for col in f.columns]
return f
|
PYTHON
|
{
"dummy_field": ""
}
|
|
d20602
|
test
|
def astensor(array: TensorLike) -> BKTensor:
"""Covert numpy array to tensorflow tensor"""
tensor = tf.convert_to_tensor(value=array, dtype=CTYPE)
return tensor
|
PYTHON
|
{
"dummy_field": ""
}
|
|
d20603
|
test
|
def list_to_csv(value):
"""
Converts list to string with comma separated values. For string is no-op.
"""
if isinstance(value, (list, tuple, set)):
value = ",".join(value)
return value
|
PYTHON
|
{
"dummy_field": ""
}
|
|
d20604
|
test
|
def _unzip_handle(handle):
"""Transparently unzip the file handle"""
if isinstance(handle, basestring):
handle = _gzip_open_filename(handle)
else:
handle = _gzip_open_handle(handle)
return handle
|
PYTHON
|
{
"dummy_field": ""
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.