这篇文章主要介绍使用spyder帮助的方法,文中介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们一定要看完!

在使用Spyder时,有可能要查询某个函数或者某个模块的具体用法。

1、要查看模块的作用说明、简介,可以直接在交互区直接输入:

print(模块名.__doc__)

例如:要查看pandas的介绍

In[1]:print(pd.__doc__)pandas-apowerfuldataanalysisandmanipulationlibraryforPython=====================================================================**pandas**isaPythonpackageprovidingfast,flexible,andexpressivedatastructuresdesignedtomakeworkingwith"relational"or"labeled"databotheasyandintuitive.Itaimstobethefundamentalhigh-levelbuildingblockfordoingpractical,**realworld**dataanalysisinPython.Additionally,ithasthebroadergoalofbecoming**themostpowerfulandflexibleopensourcedataanalysis/manipulationtoolavailableinanylanguage**.Itisalreadywellonitswaytowardthisgoal.MainFeatures-------------Herearejustafewofthethingsthatpandasdoeswell:-Easyhandlingofmissingdatainfloatingpointaswellasnon-floatingpointdata-Sizemutability:columnscanbeinsertedanddeletedfromDataFrameandhigherdimensionalobjects-Automaticandexplicitdataalignment:objectscanbeexplicitlyalignedtoasetoflabels,ortheusercansimplyignorethelabelsandlet`Series`,`DataFrame`,etc.automaticallyalignthedataforyouincomputations-Powerful,flexiblegroupbyfunctionalitytoperformsplit-apply-combineoperationsondatasets,forbothaggregatingandtransformingdata-Makeiteasytoconvertragged,differently-indexeddatainotherPythonandNumPydatastructuresintoDataFrameobjects-Intelligentlabel-basedslicing,fancyindexing,andsubsettingoflargedatasets-Intuitivemergingandjoiningdatasets-Flexiblereshapingandpivotingofdatasets-Hierarchicallabelingofaxes(possibletohavemultiplelabelspertick)-RobustIOtoolsforloadingdatafromflatfiles(CSVanddelimited),Excelfiles,databases,andsaving/loadingdatafromtheultrafastHDF5format-Timeseries-specificfunctionality:daterangegenerationandfrequencyconversion,movingwindowstatistics,movingwindowlinearregressions,dateshiftingandlagging,etc.

2、想知道某个函数的用法可以使用:

help(函数名)

例如:要查询pandas的fillna的使用方法

In[2]:help(x.fillna)Helponmethodfillnainmodulepandas.core.frame:fillna(value=None,method=None,axis=None,inplace=False,limit=None,downcast=None,**kwargs)methodofpandas.core.frame.DataFrameinstanceFillNA/NaNvaluesusingthespecifiedmethodParameters----------value:scalar,dict,Series,orDataFrameValuetousetofillholes(e.g.0),alternatelyadict/Series/DataFrameofvaluesspecifyingwhichvaluetouseforeachindex(foraSeries)orcolumn(foraDataFrame).(valuesnotinthedict/Series/DataFramewillnotbefilled).Thisvaluecannotbealist.method:{'backfill','bfill','pad','ffill',None},defaultNoneMethodtouseforfillingholesinreindexedSeriespad/ffill:propagatelastvalidobservationforwardtonextvalidbackfill/bfill:useNEXTvalidobservationtofillgapaxis:{0or'index',1or'columns'}inplace:boolean,defaultFalseIfTrue,fillinplace.Note:thiswillmodifyanyotherviewsonthisobject,(e.g.ano-copysliceforacolumninaDataFrame).limit:int,defaultNoneIfmethodisspecified,thisisthemaximumnumberofconsecutiveNaNvaluestoforward/backwardfill.Inotherwords,ifthereisagapwithmorethanthisnumberofconsecutiveNaNs,itwillonlybepartiallyfilled.Ifmethodisnotspecified,thisisthemaximumnumberofentriesalongtheentireaxiswhereNaNswillbefilled.Mustbegreaterthan0ifnotNone.downcast:dict,defaultisNoneadictofitem->dtypeofwhattodowncastifpossible,orthestring'infer'whichwilltrytodowncasttoanappropriateequaltype(e.g.float64toint64ifpossible)SeeAlso--------reindex,asfreqReturns-------filled:DataFrame

以上是使用spyder帮助的方法的所有内容,感谢各位的阅读!希望分享的内容对大家有帮助,更多相关知识,欢迎关注亿速云行业资讯频道!