我一直在玩文档中描述的pandas时间/日期组件,我注意到列出的时间/日期组件http://pandas.pydata.org/pandas-docs/stable/timeseries.html#time-date-components,其中一些是属性,其中一些是方法。例子:
在文档中是否有对此的解释和/或组件属性和方法的整体逻辑?
答案 0 :(得分:1)
如果我参考你的例子,那么:
pd.Timestamp
是财产。任何直接的熊猫操作都是熊猫属性。
以下是一些可能性:
In [4]: pd.
Display all 158 possibilities? (y or n)
pd.Categorical pd.SparseTimeSeries pd.ewmvol pd.io pd.read_excel pd.rolling_sum
pd.CategoricalIndex pd.Term pd.expanding_apply pd.isnull pd.read_fwf pd.rolling_var
pd.DataFrame pd.TimeGrouper pd.expanding_corr pd.json pd.read_gbq pd.rolling_window
pd.DateOffset pd.TimeSeries pd.expanding_count pd.lib pd.read_hdf pd.scatter_matrix
pd.DatetimeIndex pd.Timedelta pd.expanding_cov pd.lreshape pd.read_html pd.set_eng_float_format
pd.ExcelFile pd.TimedeltaIndex pd.expanding_kurt pd.match pd.read_json pd.set_option
pd.ExcelWriter pd.Timestamp pd.expanding_max pd.melt pd.read_msgpack pd.show_versions
pd.Expr pd.WidePanel pd.expanding_mean pd.merge pd.read_pickle pd.sparse
pd.Float64Index pd.algos pd.expanding_median pd.missing_dependencies pd.read_sas pd.stats
pd.Grouper pd.bdate_range pd.expanding_min pd.msgpack pd.read_sql pd.test
pd.HDFStore pd.compat pd.expanding_quantile pd.notnull pd.read_sql_query pd.timedelta_range
pd.Index pd.computation pd.expanding_skew pd.np pd.read_sql_table pd.to_datetime
pd.IndexSlice pd.concat pd.expanding_std pd.offsets pd.read_stata pd.to_msgpack
pd.Int64Index pd.core pd.expanding_sum pd.ols pd.read_table pd.to_numeric
pd.MultiIndex pd.crosstab pd.expanding_var pd.option_context pd.reset_option pd.to_pickle
pd.NaT pd.cut pd.factorize pd.options pd.rolling_apply pd.to_timedelta
pd.Panel pd.date_range pd.fama_macbeth pd.ordered_merge pd.rolling_corr pd.tools
pd.Panel4D pd.datetime pd.get_dummies pd.pandas pd.rolling_count pd.tseries
pd.Period pd.datetools pd.get_option pd.parser pd.rolling_cov pd.tslib
pd.PeriodIndex pd.dependency pd.get_store pd.period_range pd.rolling_kurt pd.unique
pd.RangeIndex pd.describe_option pd.groupby pd.pivot pd.rolling_max pd.util
pd.Series pd.eval pd.hard_dependencies pd.pivot_table pd.rolling_mean pd.value_counts
pd.SparseArray pd.ewma pd.hashtable pd.plot_params pd.rolling_median pd.wide_to_long
pd.SparseDataFrame pd.ewmcorr pd.index pd.pnow pd.rolling_min
pd.SparseList pd.ewmcov pd.indexes pd.qcut pd.rolling_quantile
pd.SparsePanel pd.ewmstd pd.infer_freq pd.read_clipboard pd.rolling_skew
pd.SparseSeries pd.ewmvar pd.info pd.read_csv pd.rolling_std
这些属性中的进一步向下钻取操作是方法。
来自你的例子:
t.dayofweek
t.weekday
是方法。