pandas: powerful Python data analysis toolkit - 0.25full docs, see the categorical introduction and the API documentation. In [127]: df = pd.DataFrame({"id": [1, 2, 3, 4, 5, 6], .....: "raw_grade": ['a', 'b', 'b', 'a', 'a', 'e']}) .....: Convert the raw is per order in the categories, not lexical order. In [133]: df.sort_values(by="grade") Out[133]: id raw_grade grade 5 6 e very bad 1 2 b good 2 3 b good 0 1 a very good 3 4 a very good 4 5 a very [138]: import statsmodels.formula.api as sm In [139]: bb = pd.read_csv('data/baseball.csv', index_col='id') In [140]: (bb.query('h > 0') .....: .assign(ln_h=lambda df: np.log(df.h)) .....: .pipe((sm.ols0 码力 | 698 页 | 4.91 MB | 1 年前3
pandas: powerful Python data analysis toolkit - 0.14.0DataFrame(dict(household_id = [1,2,3], ....: male = [0,1,0], ....: wealth = [196087.3,316478.7,294750]), ....: columns = [’household_id’,’male’,’wealth’] ....: ).set_index(’household_id’) ....: In [71]: household Out[71]: male wealth household_id 1 0 196087.3 2 1 316478.7 3 0 294750.0 In [72]: portfolio = DataFrame(dict(household_id = [1,2,2,3,3,3,4], ....: asset_id = ["nl0000301109","nl0000289783","gb00b03mlx29" = [’household_id’,’asset_id’,’name’,’share’] 1.1. v0.14.0 (May 31 , 2014) 21 pandas: powerful Python data analysis toolkit, Release 0.14.0 ....: ).set_index([’household_id’,’asset_id’]) ....: In [73]:0 码力 | 1349 页 | 7.67 MB | 1 年前3
pandas: powerful Python data analysis toolkit - 0.15For full docs, see the categorical introduction and the API documentation. In [1]: df = DataFrame({"id":[1,2,3,4,5,6], "raw_grade":[’a’, ’b’, ’b’, ’a’, ’a’, ’e’]}) In [2]: df["grade"] = df["raw_grade"] Categories (5, object): [very bad < bad < medium < good < very good] In [7]: df.sort("grade") Out[7]: id raw_grade grade 5 6 e very bad 1 2 b good 2 3 b good 0 1 a very good 3 4 a very good 4 5 a very DataFrame(dict(household_id = [1,2,3], ....: male = [0,1,0], ....: wealth = [196087.3,316478.7,294750]), ....: columns = [’household_id’,’male’,’wealth’] ....: ).set_index(’household_id’) ....: In [71]:0 码力 | 1579 页 | 9.15 MB | 1 年前3
pandas: powerful Python data analysis toolkit - 0.15.1For full docs, see the categorical introduction and the API documentation. In [1]: df = DataFrame({"id":[1,2,3,4,5,6], "raw_grade":[’a’, ’b’, ’b’, ’a’, ’a’, ’e’]}) In [2]: df["grade"] = df["raw_grade"] Categories (5, object): [very bad < bad < medium < good < very good] In [7]: df.sort("grade") Out[7]: id raw_grade grade 5 6 e very bad 1 2 b good 2 3 b good 0 1 a very good 3 4 a very good 4 5 a very DataFrame(dict(household_id = [1,2,3], ....: male = [0,1,0], ....: wealth = [196087.3,316478.7,294750]), ....: columns = [’household_id’,’male’,’wealth’] ....: ).set_index(’household_id’) ....: In [71]:0 码力 | 1557 页 | 9.10 MB | 1 年前3
pandas: powerful Python data analysis toolkit - 1.4.4the Titanic data set, stored as CSV. The data consists of the following data columns: • PassengerId: Id of every passenger. • Survived: This feature have value 0 and 1. 0 for not survived and 1 for survived the Titanic data set, stored as CSV. The data consists of the following data columns: • PassengerId: Id of every passenger. • Survived: This feature have value 0 and 1. 0 for not survived and 1 for survived the Titanic data set, stored as CSV. The data consists of the following data columns: • PassengerId: Id of every passenger. • Survived: This feature have value 0 and 1. 0 for not survived and 1 for survived0 码力 | 3743 页 | 15.26 MB | 1 年前3
pandas: powerful Python data analysis toolkit - 1.4.2the Titanic data set, stored as CSV. The data consists of the following data columns: • PassengerId: Id of every passenger. • Survived: This feature have value 0 and 1. 0 for not survived and 1 for survived the Titanic data set, stored as CSV. The data consists of the following data columns: • PassengerId: Id of every passenger. • Survived: This feature have value 0 and 1. 0 for not survived and 1 for survived the Titanic data set, stored as CSV. The data consists of the following data columns: • PassengerId: Id of every passenger. • Survived: This feature have value 0 and 1. 0 for not survived and 1 for survived0 码力 | 3739 页 | 15.24 MB | 1 年前3
pandas: powerful Python data analysis toolkit - 1.3.3the Titanic data set, stored as CSV. The data consists of the following data columns: • PassengerId: Id of every passenger. • Survived: This feature have value 0 and 1. 0 for not survived and 1 for survived the Titanic data set, stored as CSV. The data consists of the following data columns: • PassengerId: Id of every passenger. • Survived: This feature have value 0 and 1. 0 for not survived and 1 for survived the Titanic data set, stored as CSV. The data consists of the following data columns: • PassengerId: Id of every passenger. • Survived: This feature have value 0 and 1. 0 for not survived and 1 for survived0 码力 | 3603 页 | 14.65 MB | 1 年前3
pandas: powerful Python data analysis toolkit - 1.3.4the Titanic data set, stored as CSV. The data consists of the following data columns: • PassengerId: Id of every passenger. • Survived: This feature have value 0 and 1. 0 for not survived and 1 for survived the Titanic data set, stored as CSV. The data consists of the following data columns: • PassengerId: Id of every passenger. • Survived: This feature have value 0 and 1. 0 for not survived and 1 for survived the Titanic data set, stored as CSV. The data consists of the following data columns: • PassengerId: Id of every passenger. • Survived: This feature have value 0 and 1. 0 for not survived and 1 for survived0 码力 | 3605 页 | 14.68 MB | 1 年前3
pandas: powerful Python data analysis toolkit - 1.1.1the Titanic data set, stored as CSV. The data consists of the following data columns: • PassengerId: Id of every passenger. • Survived: This feature have value 0 and 1. 0 for not survived and 1 for survived the Titanic data set, stored as CSV. The data consists of the following data columns: • PassengerId: Id of every passenger. • Survived: This feature have value 0 and 1. 0 for not survived and 1 for survived the Titanic data set, stored as CSV. The data consists of the following data columns: • PassengerId: Id of every passenger. • Survived: This feature have value 0 and 1. 0 for not survived and 1 for survived0 码力 | 3231 页 | 10.87 MB | 1 年前3
pandas: powerful Python data analysis toolkit - 1.1.0the Titanic data set, stored as CSV. The data consists of the following data columns: • PassengerId: Id of every passenger. • Survived: This feature have value 0 and 1. 0 for not survived and 1 for survived the Titanic data set, stored as CSV. The data consists of the following data columns: • PassengerId: Id of every passenger. • Survived: This feature have value 0 and 1. 0 for not survived and 1 for survived the Titanic data set, stored as CSV. The data consists of the following data columns: • PassengerId: Id of every passenger. • Survived: This feature have value 0 and 1. 0 for not survived and 1 for survived0 码力 | 3229 页 | 10.87 MB | 1 年前3
共 32 条
- 1
- 2
- 3
- 4













