pandas SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame.

pandas : SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame. どちらでも Warning: 1 2 3 4 5 6 def _balance(df): if df["bookitem_kind"] == "1": return -1 * df["amount"] return df["amount"] df_epm_cost["amount2"] = df_epm_cost.apply(_balance, axis=1) 1 df_epm_cost["amount"].where(df_epm_cost["bookitem_kind"] == "0", -1 * df_epm_cost["amount"], inplace=True) ValueError: cannot reindex on an axis with duplicate labels 1 df_epm_cost.loc[df_epm_cost["bookitem_kind"] == "1", "amount2"] = df_epm_cost["amount"] * (-1) FutureWarning: reindexing with a non-unique Index is deprecated and will raise in a future version ValueError: cannot reindex on an axis with duplicate labels インデックスを削除するとうまく行く: ...

2023年8月20日 · 1 分

cp932

CP932 の最大バイト数を超えない長さで文字列を丸める 1 from itertools import accumulate 1 2 3 4 5 6 7 8 9 def cp932_substr(source, max_length): """CP932での最大バイト数(max_length) を超えない文字数で丸める""" if not source: return "" data = map(lambda i: len(i.encode("cp932")), source) target = filter(lambda i: i <= max_length, accumulate(data)) count = len(list(target)) return source[:count]

2023年6月21日 · 1 分

pandas 指定カラムがnan以外のレコードのみ抽出

pandas: notna(): 指定カラムがnan以外のレコードのみ抽出 ダウンロードExcelファイルの 行数カラム に値がはいっているとエラー行: 1 2 3 4 5 6 names = { "行数": "line", "メッセージ": "message", } df = self.dataframe(response)[["行数", "メッセージ"]].rename(columns=names) df = df[df["line"].notna()]

2023年5月25日 · 1 分

## Cognite(MAU=5,000) Show calculations

Cognite(MAU=5,000) Show calculations MAU = 5,000 Unit conversions Percent of monthly users who sign in through SAML or OIDC federation: 10 / 100 = 0.1 Pricing calculations SAML or OIDC federation cost (monthly) 5,000 MAUs x 0.10 SAML or OIDC federation requests = 500.00 SAML or OIDC federation MAU requests 500.00 SAML or OIDC federation MAUs - 50 free SAML or OIDC federation MAU requests per month = 450.00 billable SAML or OIDC federation MAU requests Max (450.00 billable SAML or OIDC federation MAU requests, 0 minimum billable SAML or OIDC federation MAU requests) = 450 total billable SAML or OIDC federation MAU requests 450 MAUs x 0.015 USD = 6.75 USD (SAML or OIDC federation MAU requests) SAML or OIDC federation cost (monthly): 6.75 USD User Pool MAU cost (monthly) 5,000 MAUs - 50000 free MAU requests per month = -45,000.00 billable MAU requests Max (-45000.000000 billable MAU requests, 0 Constant Unit) = 0.00 total billable MAU requests Tiered price for: 0.00 MAUs Total tier cost = 0.00 USD (User Pool MAUs) User Pool MAU cost (monthly): 0.00 USD Advanced security feature cost (monthly) 5,000 MAUs x 1 Advanced security features option enabled = 5,000.00 Advanced security feature MAUs Tiered price for: 5000.00 MAUs 5000 MAUs x 0.0500000000 USD = 250.00 USD Total tier cost = 250.00 USD (ASF MAUs) Advanced security feature cost (monthly): 250 USD Cognito MAU cost (monthly) 250 USD + 6.75 USD = 256.75 USD Cognito MAU cost (monthly): 256.75 USD

2023年5月8日 · 2 分

autossh

autossh autossh は、ssh 接続が切断された場合に自動的に再接続してくれるプログラムです。 autossh を使用すると、ssh サービスを開始し、監視することができます。 プログラムの問題やネットワークの問題が発生した場合、ssh サービスを再起動できます。¹²³ 以下のように使用します。 1 autossh -M 0 -N -f -o "ServerAliveInterval 30" -o "ServerAliveCountMax 3" -R 8080:localhost:80 user@remote_host この例では、リモートホスト上でポート 8080 を開き、ローカルホストのポート 80 に転送します。⁴ ソース: Bing との会話 2023/5/5 (1) 用 autossh 工具进行端口转发 - 腾讯云开发者社区-腾讯云. https://cloud.tencent.com/developer/article/1836005. (2) autossh 工具进行端口转发 - 简书. https://www.jianshu.com/p/ae2cd8d9a368. (3) 用 autossh 工具进行端口转发 | Escape. https://www.escapelife.site/posts/e6647650.html. (4) ssh 接続を維持し続ける autossh の使い方 – ぺけみさお - xmisao. https://www.xmisao.com/2013/07/16/autossh-how-to.html. (5) CentOS で autossh を systemd service として動かす - Qiita. https://qiita.com/sandopan65/items/e21bdf710ac70f691e21. (6) autossh と ssh ポートフォワードでルータ内のマシンにアクセスする …. https://qiita.com/wf9a5m75/items/a78262532ac4823104f0. ポートフォワード (-L, -R, -D) -L : ローカル -> リモート -R : リモート -> ローカル -D : ダイナミック(SOCKS) -N -N オプションは、ssh 接続を開始して、リモートシェルを実行しないようにします。¹²³ ...

2023年5月5日 · 2 分

Google Spreadsheet を TSVファイルに落とす

gsheet.py Googleスプレッドシートのダウンロード メインオプション Usage: gsheet.py [OPTIONS] COMMAND [ARGS]... Tools Subcommand Options: -s, --secret_file TEXT クレデンシャルJSONファイル -o, --out TEXT --help Show this message and exit. Commands: extract URLのシートは クレデンシャルJSONの client_email に対して共有設定すること extract サブコマンド: Usage: gsheet.py extract [OPTIONS] URL URLのシートは クレデンシャルJSONの client_email に対して共有設定すること Options: -n, --sheet_name TEXT --help Show this message and exit. インストール 1 pip install click gspread google-auth-httplib2 oauth2client クレデンシャルJSONの作り方: https://note.com/kohaku935/n/ned9e907aac77 GCPでプロジェクト作成 (https://console.cloud.google.com/) APIとサービス > ライブラリ から Google Drive API を有効 APIとサービス > ライブラリ から Google Sheets AP Iを有効 APIとサービス > 認証情報 > 認証情報を作成 でサービスアカウント を作成 サービスアカウント に 編集者 ロールを設定 APIとサービス > 認証情報 > 作成した サービスアカウント を選択し、キー の生成 キー画面で、鍵を追加 。 新しい鍵を作成 で作成。 タイプにJSONを選択。 ダウンロードされたJSONを適切な場所に保存

2023年3月18日 · 1 分

Radio

Radio 曜日 Ch 時間 番組 月 J-Wave 22:00 - 24:00 SONAR MUSIC 月 NHK 24:00 - 24:50 夜のプレイリスト 火 J-Wave 22:00 - 24:00 SONAR MUSIC 火 NHK 24:00 - 24:50 夜のプレイリスト 水 J-Wave 22:00 - 24:00 SONAR MUSIC 水 NHK 24:00 - 24:50 夜のプレイリスト 木 J-Wave 22:00 - 24:00 SONAR MUSIC 木 NHK 24:00 - 24:50 夜のプレイリスト 金 InterFM 897 20:00 - 22:00 TOKYO SCENE 金 NHK 24:00 - 24:50 夜のプレイリスト 金 InterFM 897 24:00 - 25:00 beatDAYZ 土 Fm yokohama84.7 24:00 - 25:00 Bayside Reggae Lounge 日 J-Wave 20:00 - 21:00 Travelling without Moving Station Apple Music Radio BBC Sound nts worldwidefm soundcloud mixcloud

2021年5月10日 · 1 分

gistpad-scratch

‎‎​

2021年4月22日 · 1 分

2020-11-30

1 2 3 const logger = require('electron-log'); logger.log(`${logger.transports.file.getFile()}`) C:\Users\hdknr\AppData\Roaming\electron-osc-js\logs\main.log

2020年11月30日 · 1 分

王子

パン ロワンモンターニュ (王子本町)

2018年11月29日 · 1 分