 pandas: powerful Python data analysis toolkit - 0.7.3x foo one x 3 w foo two w 4 In [590]: df = data.set_index([’a’, ’b’], inplace=True) In [591]: data Out[591]: c d a b bar one z 1 two y 2 foo one x 3 two w 4 7.5. Adding an index to an existing0 码力 | 297 页 | 1.92 MB | 1 年前3 pandas: powerful Python data analysis toolkit - 0.7.3x foo one x 3 w foo two w 4 In [590]: df = data.set_index([’a’, ’b’], inplace=True) In [591]: data Out[591]: c d a b bar one z 1 two y 2 foo one x 3 two w 4 7.5. Adding an index to an existing0 码力 | 297 页 | 1.92 MB | 1 年前3
 pandas: powerful Python data analysis toolkit - 0.7.1index column Consider a file with one less entry in the header than the number of data column: In [591]: print open(’foo.csv’).read() A,B,C 20090101,a,1,2 20090102,b,3,4 20090103,c,4,5 In this special0 码力 | 281 页 | 1.45 MB | 1 年前3 pandas: powerful Python data analysis toolkit - 0.7.1index column Consider a file with one less entry in the header than the number of data column: In [591]: print open(’foo.csv’).read() A,B,C 20090101,a,1,2 20090102,b,3,4 20090103,c,4,5 In this special0 码力 | 281 页 | 1.45 MB | 1 年前3
 pandas: powerful Python data analysis toolkit - 0.7.2index column Consider a file with one less entry in the header than the number of data column: In [591]: print open(’foo.csv’).read() A,B,C 20090101,a,1,2 20090102,b,3,4 20090103,c,4,5 In this special0 码力 | 283 页 | 1.45 MB | 1 年前3 pandas: powerful Python data analysis toolkit - 0.7.2index column Consider a file with one less entry in the header than the number of data column: In [591]: print open(’foo.csv’).read() A,B,C 20090101,a,1,2 20090102,b,3,4 20090103,c,4,5 In this special0 码力 | 283 页 | 1.45 MB | 1 年前3
 pandas: powerful Python data analysis toolkit - 0.14.0. . . . . . . . . . . . . . . . . . . . 591 20.5 World Bank . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 591 21 Enhancing Performance 595 21.1 Cython with a hierarchical index, so it is easy to apply .groupby transformations to it: 20.4. Fama/French 591 pandas: powerful Python data analysis toolkit, Release 0.14.0 In [6]: dat[’NY.GDP.PCAP.KD’].groupby(level=0)0 码力 | 1349 页 | 7.67 MB | 1 年前3 pandas: powerful Python data analysis toolkit - 0.14.0. . . . . . . . . . . . . . . . . . . . 591 20.5 World Bank . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 591 21 Enhancing Performance 595 21.1 Cython with a hierarchical index, so it is easy to apply .groupby transformations to it: 20.4. Fama/French 591 pandas: powerful Python data analysis toolkit, Release 0.14.0 In [6]: dat[’NY.GDP.PCAP.KD’].groupby(level=0)0 码力 | 1349 页 | 7.67 MB | 1 年前3
 pandas: powerful Python data analysis toolkit - 1.4.2. . . . . . . . . . . . . . . . . . . . . . 591 2.9.6 Extracting substrings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 591 2.9.7 Testing for strings that match or contain [590]: import sqlalchemy as sa In [591]: pd.read_sql( .....: sa.text("SELECT * FROM data where Col_1=:col1"), engine, params={"col1": "X ˓→"} .....: ) .....: Out[591]: index id Date Col_1 Col_2 Col_3 with more than one group returns a DataFrame with one column per group. 2.9. Working with text data 591 pandas: powerful Python data analysis toolkit, Release 1.4.2 In [103]: pd.Series( .....: ["a1",0 码力 | 3739 页 | 15.24 MB | 1 年前3 pandas: powerful Python data analysis toolkit - 1.4.2. . . . . . . . . . . . . . . . . . . . . . 591 2.9.6 Extracting substrings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 591 2.9.7 Testing for strings that match or contain [590]: import sqlalchemy as sa In [591]: pd.read_sql( .....: sa.text("SELECT * FROM data where Col_1=:col1"), engine, params={"col1": "X ˓→"} .....: ) .....: Out[591]: index id Date Col_1 Col_2 Col_3 with more than one group returns a DataFrame with one column per group. 2.9. Working with text data 591 pandas: powerful Python data analysis toolkit, Release 1.4.2 In [103]: pd.Series( .....: ["a1",0 码力 | 3739 页 | 15.24 MB | 1 年前3
 pandas: powerful Python data analysis toolkit - 1.4.4. . . . . . . . . . . . . . . . . . . . . . 591 2.9.6 Extracting substrings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 591 2.9.7 Testing for strings that match or contain ....: "i": pd.date_range("20130101", periods=3, freq="ns"), .....: } .....: ) .....: In [591]: df Out[591]: a b c d e f g h ␣ ˓→ i 0 a 1 3 4.0 True a 2013-01-01 2013-01-01 00:00:00-05:00 2013-01-01 with more than one group returns a DataFrame with one column per group. 2.9. Working with text data 591 pandas: powerful Python data analysis toolkit, Release 1.4.4 In [103]: pd.Series( .....: ["a1",0 码力 | 3743 页 | 15.26 MB | 1 年前3 pandas: powerful Python data analysis toolkit - 1.4.4. . . . . . . . . . . . . . . . . . . . . . 591 2.9.6 Extracting substrings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 591 2.9.7 Testing for strings that match or contain ....: "i": pd.date_range("20130101", periods=3, freq="ns"), .....: } .....: ) .....: In [591]: df Out[591]: a b c d e f g h ␣ ˓→ i 0 a 1 3 4.0 True a 2013-01-01 2013-01-01 00:00:00-05:00 2013-01-01 with more than one group returns a DataFrame with one column per group. 2.9. Working with text data 591 pandas: powerful Python data analysis toolkit, Release 1.4.4 In [103]: pd.Series( .....: ["a1",0 码力 | 3743 页 | 15.26 MB | 1 年前3
 pandas: powerful Python data analysis toolkit - 0.21.1. . . . . . . . . . . . . . . . . . . . . . 591 10.3.1 Extract first match in each subject (extract) . . . . . . . . . . . . . . . . . . . . . . . . . . 591 10.3.2 Extract all matches in each subject 'c3']).str.extract('[ab](\d)', expand=True) Out[45]: 0 0 1 1 2 2 NaN 10.3. Extracting Substrings 591 pandas: powerful Python data analysis toolkit, Release 0.21.1 It returns a Series if expand=False0 码力 | 2207 页 | 8.59 MB | 1 年前3 pandas: powerful Python data analysis toolkit - 0.21.1. . . . . . . . . . . . . . . . . . . . . . 591 10.3.1 Extract first match in each subject (extract) . . . . . . . . . . . . . . . . . . . . . . . . . . 591 10.3.2 Extract all matches in each subject 'c3']).str.extract('[ab](\d)', expand=True) Out[45]: 0 0 1 1 2 2 NaN 10.3. Extracting Substrings 591 pandas: powerful Python data analysis toolkit, Release 0.21.1 It returns a Series if expand=False0 码力 | 2207 页 | 8.59 MB | 1 年前3
 pandas: powerful Python data analysis toolkit - 0.25plot(color='r') .....: df.B.plot(color='g') .....: df.C.plot(color='b') .....: 4.10. Visualization 591 pandas: powerful Python data analysis toolkit, Release 0.25.3 Automatic date tick adjustment New0 码力 | 698 页 | 4.91 MB | 1 年前3 pandas: powerful Python data analysis toolkit - 0.25plot(color='r') .....: df.B.plot(color='g') .....: df.C.plot(color='b') .....: 4.10. Visualization 591 pandas: powerful Python data analysis toolkit, Release 0.25.3 Automatic date tick adjustment New0 码力 | 698 页 | 4.91 MB | 1 年前3
 pandas: powerful Python data analysis toolkit - 0.12dtype: float64 • Improvement to Yahoo API access in pd.io.data.Options (GH2758) 26.2. Where to get it 591 pandas: powerful Python data analysis toolkit, Release 0.12.0 • added option display.max_seq_items0 码力 | 657 页 | 3.58 MB | 1 年前3 pandas: powerful Python data analysis toolkit - 0.12dtype: float64 • Improvement to Yahoo API access in pd.io.data.Options (GH2758) 26.2. Where to get it 591 pandas: powerful Python data analysis toolkit, Release 0.12.0 • added option display.max_seq_items0 码力 | 657 页 | 3.58 MB | 1 年前3
 pandas: powerful Python data analysis toolkit - 0.17.0Converting to Timestamps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 591 20.4 Generating Ranges of Timestamps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . DatetimeIndex(['2005-11-23', '2010-12-31'], dtype='datetime64[ns]', freq=None) 20.3. Converting to Timestamps 591 pandas: powerful Python data analysis toolkit, Release 0.17.0 If you use dates which start with the0 码力 | 1787 页 | 10.76 MB | 1 年前3 pandas: powerful Python data analysis toolkit - 0.17.0Converting to Timestamps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 591 20.4 Generating Ranges of Timestamps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . DatetimeIndex(['2005-11-23', '2010-12-31'], dtype='datetime64[ns]', freq=None) 20.3. Converting to Timestamps 591 pandas: powerful Python data analysis toolkit, Release 0.17.0 If you use dates which start with the0 码力 | 1787 页 | 10.76 MB | 1 年前3
共 32 条
- 1
- 2
- 3
- 4













