@@ -877,13 +877,13 @@ def lreshape(data, groups, dropna=True, label=None):
877
877
878
878
879
879
def wide_to_long (df , stubnames , i , j , sep = "" , suffix = '\d+' ):
880
- """
880
+ r """
881
881
Wide panel to long format. Less flexible but more user-friendly than melt.
882
882
883
883
With stubnames ['A', 'B'], this function expects to find one or more
884
884
group of columns with format Asuffix1, Asuffix2,..., Bsuffix1, Bsuffix2,...
885
885
You specify what you want to call this suffix in the resulting long format
886
- with `j` (for example `j` ='year')
886
+ with `j` (for example `j='year'` )
887
887
888
888
Each row of these wide variables are assumed to be uniquely identified by
889
889
`i` (can be a single column name or a list of column names)
@@ -906,14 +906,14 @@ def wide_to_long(df, stubnames, i, j, sep="", suffix='\d+'):
906
906
A character indicating the separation of the variable names
907
907
in the wide format, to be stripped from the names in the long format.
908
908
For example, if your column names are A-suffix1, A-suffix2, you
909
- can strip the hypen by specifying `sep` ='-'
910
- suffix : str, default '\d+'
911
- A regular expression capturing the wanted suffixes. '\d+' captures
909
+ can strip the hypen by specifying `sep='-'`
910
+ suffix : str, default '\\ d+'
911
+ A regular expression capturing the wanted suffixes. '\\ d+' captures
912
912
numeric suffixes. Suffixes with no numbers could be specified with the
913
- negated character class '\D+'. You can also further disambiguate
913
+ negated character class '\\ D+'. You can also further disambiguate
914
914
suffixes, for example, if your wide variables are of the form
915
915
Aone, Btwo,.., and you have an unrelated column Arating, you can
916
- ignore the last one by specyfing `suffix` ='(!?one|two)'
916
+ ignore the last one by specifying `suffix='(!?one|two)'`
917
917
918
918
Returns
919
919
-------
0 commit comments