sudo chown -R jenkins:jenkins /var/lib/jenkins/workspace
from : https://stackoverflow.com/questions/50782740/why-is-jenkins-suddenly-unable-to-delete-a-workspace
sudo chown -R jenkins:jenkins /var/lib/jenkins/workspace
from : https://stackoverflow.com/questions/50782740/why-is-jenkins-suddenly-unable-to-delete-a-workspace
The simplest way is with pyperclip. Works in python 2 and 3.
To install this library, use:
pip install pyperclip
Example usage:
import pyperclip
pyperclip.copy("your string")
If you want to get the contents of the clipboard:
clipboard_content = pyperclip.paste()
from :
https://stackoverflow.com/questions/579687/how-do-i-copy-a-string-to-the-clipboard-on-windows-using-python
https://stackoverflow.com/questions/45014501/trying-to-write-copied-data-in-a-text-file-in-python
Index is an object, and default index starts from 0
:
>>> result.index
Int64Index([0, 1, 2], dtype=int64)
You can shift this index by 1
with
>>> result.index += 1
>>> result.index
Int64Index([1, 2, 3], dtype=int64)
from : https://stackoverflow.com/questions/20167930/start-index-at-1-for-pandas-dataframe
convert the values to integer:
df['contig'] = df['contig'].astype(int)
df['pos'] = df['pos'].astype(int)
Then sort with inplace
df.sort_values(by=['contig', 'pos'], inplace=True, ascending=True)
from : https://stackoverflow.com/questions/43396993/pandas-is-treating-integer-values-as-strings-while-sorting-why/43400971
As the error states, you can only use .str
with string columns, and you have a float64
. There won't be any commas in a float, so what you have won't really do anything, but in general, you could cast it first:
dc_listings['price'].astype(str).str.replace...
from : https://stackoverflow.com/questions/52065909/attributeerror-can-only-use-str-accessor-with-string-values-which-use-np-obje
datetime
objects can be placed in Pandas DataFrame
columns. Two columns can be subtracted to return a series of timedelta
objects representing the time difference between each row in the two columns.
pandas.to_datetime()
TO CALCULATE A PANDAS DATAFRAME TIME DIFFERENCE BETWEEN TWO COLUMNSCall pandas.to_datetime(column)
with column
as a column of time strings to return a Pandas Series
of datetime
objects. Use the syntax df.second - df.first
to subtract the first column from the second column.
df = pd.DataFrame(columns=["one", "two"])
df.one = ["2019-01-24","2019-01-27"]
df.one = pd.to_datetime(df.one)
df.two = ["2019-01-28", "2020-01-29"]
df.two = pd.to_datetime(df.two)
print(df)
one two
0 2019-01-24 2019-01-28
1 2019-01-27 2020-01-29
difference = (df.two - df.one)
print(difference)
0 4 days
1 367 days
dtype: timedelta64[ns]
from : https://www.kite.com/python/answers/how-to-calculate-a-pandas-dataframe-time-difference-between-two-columns-in-python
#!/bin/sh
value=`cat config.txt`
echo "$value"
from : https://stackoverflow.com/questions/7427262/how-to-read-a-file-into-a-variable-in-shell
#!/bin/bash
cd "$(dirname "$0")"
from : https://stackoverflow.com/questions/3349105/how-to-set-current-working-directory-to-the-directory-of-the-script-in-bash
Maybe something like this:
sed 's/ab/~~/g; s/bc/ab/g; s/~~/bc/g'
from : https://stackoverflow.com/questions/26568952/how-to-replace-multiple-patterns-at-once-with-sed
In case if you want to check whether file does not contain a specific string, you can do it as follows. if ! grep -q SomeString "$File...