Help us understand the problem. What is going on with this article?

>>> >>> import pandas as pd >>> >>> data_dict = {'A':[100, 564, 347], 'B':[1200, 853, 139]} >>> df = pd.DataFrame(data_dict) >>> >>> print(type(df)) <class 'pandas.core.frame.DataFrame'> >>> >>> print(df) A B 0 100 1200 1 564 853 2 347 139 >>> >>> print(df['A']) 0 100 1 564 2 347 Name: A, dtype: int64 >>> >>> print(df['B']) 0 1200 1 853 2 139 Name: B, dtype: int64 >>> >>> df['A * B + 2*A'] = df['A
dtypeに何も指定せずにいると、勝手に型を判別してしまいます。 例えば以下のようなタブ区切りのデータがあった場合 data_1.txt id x01 x02 x03 x04 x05 x06 x07 x08 x09 x10 0001 0.54 0.54 0.85 0.79 0.54 0.36 0.28 0.52 0.21 0.49 0002 0.72 0.68 0.77 0.69 0.07 na 0.29 0.42 0.32 0.51 0003 0.68 0.99 0.19 0.16 0.31 0.76 0.57 0.08 0.07 0.98 0004 0.98 na 0.49 0.47 0.09 0.52 0.42 0.35 0.83 0.64 0005 0.37 0.35 0.99 0.88 0.81 0.46 0.57 0.47 0.06 0.55 # coding: UTF-8 i
はじめに Excelでしか保存されていないデータをpandasで扱うときの備忘録。 正直に言うとバッドノウハウの塊かも。 本当に効率よくやりたいんならインフラをちゃんと整備しましょうね。 やりたいこと Excelをcsvにしてほかのシステムに投入する 各シートに分かれたデータを一つのDataFrameにする Excelを扱うときにはpandas.read_excelをよく使うが、複数のシートを扱うときにはpandas.ExcelFileを使うと便利。 https://pandas.pydata.org/pandas-docs/stable/generated/pandas.ExcelFile.parse.html pandas.ExcelFile.sheet_namesでシート名のリストを取得 pandas.ExcelFile.parse(pandas.read_excelと同じ)でシート
1. show all the rows or columns from a DataFrame in Jupyter QTConcole if the df has a lot of rows or columns, then when you try to show the df, pandas will auto detect the size of the displaying area and automatically hide some part of the data by replacing with .... To show the full data without any hiding, you can use pd.set_option('display.max_rows', 500) and pd.set_option('display.max_rows', 5
import numpy as np import pandas as pd cols = ['var1', 'var2', 'var3', 'var4'] df1 = pd.DataFrame(np.random.randn(4, 4), columns=cols) df2 = pd.DataFrame(np.arange(16).reshape(4, 4), columns=cols) df1 var1 var2 var3 var4 0 -0.083782 0.964222 0.832664 -0.528963 1 0.017696 0.144067 0.093823 0.147779 2 -0.082808 -0.893112 -0.477983 -0.623641 3 0.581019 -1.603081 -0.717007 0.849844 df2 var1 var2 var3
Bug Fixes¶ Fixed a bug in failing to compute rolling computations of a column-MultiIndexed DataFrame (GH16789, GH16825) Fixed a pytest marker failing downstream packages’ tests suites (GH16680) Conversion¶ Bug in pickle compat prior to the v0.20.x series, when UTC is a timezone in a Series/DataFrame/Index (GH16608) Bug in Series construction when passing a Series with dtype='category' (GH16524). B
こんなサイトのテーブルをpandasのデータフレームに取り込みたくて、BeautifulSoupのタグからリストに変換して・・・と色々やっていたそこのあなた! なんと、read_html(flavor='bs4')だけで簡単に持ってくることができますよ。 (え?知ってた?・・・自分は知らなくてずっと損してましたorz) import pandas as pd tables = pd.read_html('http://stocks.finance.yahoo.co.jp/stocks/history/?code=998407.O', flavor='bs4') print(tables[1]) """ 0 1 2 3 4 0 日付 始値 高値 安値 終値 1 2015年11月19日 19851.24 19959.06 19761.56 19859.81 2 2015年11月18日 1977
データ分析やデータ加工、機械学習などを行うのに便利な Python ライブラリを紹介する。 なぜ Python なのか 統計や機械学習をするなら、 R という選択肢もある。 R のデータの加工や集計、統計処理に優れた言語であり、言語標準の機能だけでかなりのことができる。機械学習のライブラリも充実しており、有力な選択肢であることは間違いない。 R と比較して Python が優れている点は、周辺エコシステムの充実にある。 Python エコシステムはデータサイエンスの分野に留まらない。 NumPy や Pands で加工したデータを Django を使った本格的な Web アプリケーションで利用することも可能だ。 ライブラリ群のインストール ここで挙げているライブラリのほとんどは Anaconda で一括でインストールできる。 データ加工 NumPy NumPy は数値計算を効率的に行うため
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く