• Skip to main content
  • Skip to primary sidebar

学習記録

Python 基本

Jupyterからテーブル作成して要素追加

2020年3月25日 by 河副 太智 Leave a Comment

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import psycopg2
 
# Open a DB session
dbSession = psycopg2.connect("dbname='socialmedia' user='postgres' password='abc'");
dbSession.set_isolation_level(ISOLATION_LEVEL_AUTOCOMMIT);
# Open a database cursor
dbCursor = dbSession.cursor();
# SQL statement to create a table
sqlCreateTable  = "CREATE TABLE test_table(id bigint, cityname varchar(128), latitude numeric, longitude numeric);";
# Execute CREATE TABLE command
dbCursor.execute(sqlCreateTable);
# Insert statements
sqlInsertRow1  = "INSERT INTO test_table values(1, 'New York City', 40.73, -73.93)";
sqlInsertRow2  = "INSERT INTO test_table values(2, 'San Francisco', 37.733, -122.446)";
 
 
# Insert statement
dbCursor.execute(sqlInsertRow1);
dbCursor.execute(sqlInsertRow2);
 
# Select statement
sqlSelect = "select * from test_table";
dbCursor.execute(sqlSelect);
rows = dbCursor.fetchall();
 
# Print rows
for row in rows:
    print(row);

結果

(1, ‘New York City’, Decimal(‘40.73’), Decimal(‘-73.93’))
(2, ‘San Francisco’, Decimal(‘37.733’), Decimal(‘-122.446’))

Filed Under: Python 基本

ATOMでコンソール

2018年9月3日 by 河副 太智 Leave a Comment

ATOM画面左下の+を押して、”ipython”と入力する

Filed Under: Python 基本 Tagged With: ATOM, ipython, コンソール

機械学習の特徴量抽出を英語で

2018年1月27日 by 河副 太智 Leave a Comment

Feature Extraction

Filed Under: Python 基本

pipコマンド

2018年1月19日 by 河副 太智 Leave a Comment

パッケージインストール

1
2
3
4
5
6
7
8
9
python -m pip install <PackageName>
 
or
 
python -m pip install <PackageName>==<VersionNumber>
 
or
 
python -m pip install numpy==1.11.0

 

一括インストール

1
2
3
4
5
6
7
8
9
python -m pip install -r requirements.txt
 
 
テキストを作成
 
requirements.txt
 
numpy==1.11.0
six==1.10.0

 

パッケージのアンインストール

1
python -m pip uninstall <PackageName>

 

インストール済みパッケージの確認

1
python -m pip freeze

 

 

pipの有無

1
2
3
4
python -m pip -V
 
pip 8.1.2 from C:¥python27¥lib¥site-packages (python 2.7)と出れば
インストール済

 

pipのインストール
https://bootstrap.pypa.io/get-pip.py
からダウンロードしてから

1
python get-pip.py

 

pipのアップグレード

1
python -m pip install --upgrade pip

 

Filed Under: Python 基本

AI Mind Mapping

2017年12月20日 by 河副 太智 Leave a Comment

Filed Under: Python 基本

Jupyter上のcsv等をJupyterのコードで操作する

2017年12月20日 by 河副 太智 Leave a Comment

Jupyterの同じ階層にcsvをアップする

1
sales_sparkring = pd.read_csv('monthly-australian-wine-sales-th-sparkling.csv')

 

Filed Under: Python 基本 Tagged With: csv, excel, エクセル

  • Page 1
  • Page 2
  • Page 3
  • Interim pages omitted …
  • Page 5
  • Go to Next Page »

Primary Sidebar

カテゴリー

  • AWS
  • Bootstrap
  • Dash
  • Django
  • flask
  • GIT(sourcetree)
  • Plotly/Dash
  • VPS
  • その他tool
  • ブログ
  • プログラミング
    • Bokeh
    • css
    • HoloViews
    • Jupyter
    • Numpy
    • Pandas
    • PosgreSQL
    • Python 基本
    • python3
      • webアプリ
    • python3解説
    • scikit-learn
    • scipy
    • vps
    • Wordpress
    • グラフ
    • コマンド
    • スクレイピング
    • チートシート
    • データクレンジング
    • ブロックチェーン
    • 作成実績
    • 時系列分析
    • 機械学習
      • 分析手法
      • 教師有り
    • 異常値検知
    • 自然言語処理
  • 一太郎
  • 数学
    • sympy
      • 対数関数(log)
      • 累乗根(n乗根)
    • 暗号学

Copyright © 2025 · Genesis Sample on Genesis Framework · WordPress · Log in