mkdir data_copy
cp -r data data_copy
rm -r data

 


ps
df
vmstat
jobs
ps aux|grep {process_name}

 

https://github.com/dfirst-education/sample/blob/dev/_sample_execute_py_from_sh/sample.md


with open('.\\input.jsonl') as f:
    for line in f:
       if line.find('{"target_words": "') >= 0:
        with open('.\\output.jsonl', "a") as f:
            f.write(line)

https://github.com/dfirst-education/sample/blob/dev/dataframe_create.ipynb

import pandas as pd

# changing format

pd.get_option("display.max_columns")
pd.get_option("display.max_colwidth")
pd.set_option('display.max_columns', 50)
pd.set_option('display.max_colwidth', 100)

 

# reading excel file to dataframe

df = pd.read_excel('.\\input_target.xlsx', index_col=0)

# reading csv file to dataframe

df = pd.read_csv('.\\ input_target.csv', header=0)

# reading jsonl file to dataframe

df = pd.read_json('.\\ input_target.jsonl', orient='records', lines=True)

 

# showing dataframe

df [0:2]

print(df.shape)

df.dtypes

 

# Replacing NaN with Zero 0

df = df.fillna(0)

 

# Changing column type

df['column1'] = df[' column1'].astype('object')

 

 

# selecting rows with a condition

df_selected_rows = df.query('col1 in ["value1", " value2"]')

# selecting columns

df_selected_columns = df.loc[:, ["column1", " column2"]]

df_selected_columns = df.iloc[:, [0, 1]]

 

 

# writing dataframe to csv file

df.to_csv("output_target.csv")

# writing dataframe to json file

df [["column1", " column2", " column3"]].to_json("output_target.json", orient='records')

 

# resetting index

df_selected_rows.reset_index(inplace=True, drop=True)

 

 

# sample of creating dataframe and inserting data with index

googleapikey = 'API Key'
gmaps = googlemaps.Client(key=googleapikey)

df_location = pd.DataFrame(columns=["city", "lat", "lng"])
i = 0
with open("./city-list.csv", "r", encoding="utf-8_sig") as f:
    reader = csv.reader(f, delimiter='\t')
    for row in reader:
        result = gmaps.geocode(row[0])
        if len(result) != 0:
            lat = result[0]["geometry"]["location"]["lat"]
            lng = result[0]["geometry"]["location"]["lng"]
        data = {'city' : row[0], 'lat' : lat, 'lng' : lng}
        df_location.loc[i] = data # specifying index
        i += 1
        time.sleep(1.0)

# outer join

df3 = pd.merge(df, df2, on="column1", how="outer")

Key Bindings for Visual Studio Code

https://code.visualstudio.com/docs/getstarted/keybindings

 

  • Toggle Word Wrap (editor.action.toggleWordWrap) : Alt+z

The code can be wrapped by the width of the editor.

 

  • Format Document (editor.action.formatDocument) : Shift+Alt+F

Can normalize Json files

 

  • Multiple selection of words : Ctrl+D

Can edit or replace selected words.

 

  • Command input mode : Ctrl+Shift+P

Can execute git command and so on.

 

  • Comment-out : Ctrl+/

Can do comment-out for multi-rows

  1. Go to the GCP Website:
    Visit the official Google Cloud Platform website at https://cloud.google.com.
  2. Click "Start Free": On the GCP homepage.
  3. Sign in with your Google Account: If you already have a Google Account, sign in using your existing credentials. If you don't have one, you'll need to create a new Google Account to proceed.
  4. Provide Account Information: Google may ask you for some basic information, including your name, contact details, and billing address. It's important to provide accurate information, as this will be used for billing and account management purposes.
  5. Accept Terms and Conditions: Review and accept the terms of service and privacy policy for Google Cloud Platform.
  6. Set Up Billing: To use certain GCP services, you'll need to set up a billing account. Google typically provides a free trial with a certain amount of credit, so you can explore the platform before incurring charges.
  7. Choose a Payment Method: Add a valid payment method to your billing account. This can be a credit card or other accepted payment options, depending on your location.
  8. Review and Confirm: Double-check all the information you provided, including your billing details, to ensure accuracy.
  9. Agree to Terms and Create Account: Once you've reviewed everything, agree to the terms and conditions, and create your Google Cloud Platform account.
  10. Access the GCP Console: After creating your account, you'll be directed to the GCP Console, where you can start exploring and using the various cloud services.