@@ -3106,14 +3106,91 @@ def index(self):
3106
3106
index is used for label-based access and alignment, and can be accessed
3107
3107
or modified using this attribute.
3108
3108
3109
+ **Examples:**
3110
+
3111
+ >>> import bigframes.pandas as bpd
3112
+ >>> bpd.options.display.progress_bar = None
3113
+
3114
+ You can access the index of a DataFrame via ``index`` property.
3115
+
3116
+ >>> df = bpd.DataFrame({'Name': ['Alice', 'Bob', 'Aritra'],
3117
+ ... 'Age': [25, 30, 35],
3118
+ ... 'Location': ['Seattle', 'New York', 'Kona']},
3119
+ ... index=([10, 20, 30]))
3120
+ >>> df
3121
+ Name Age Location
3122
+ 10 Alice 25 Seattle
3123
+ 20 Bob 30 New York
3124
+ 30 Aritra 35 Kona
3125
+ <BLANKLINE>
3126
+ [3 rows x 3 columns]
3127
+ >>> df.index # doctest: +ELLIPSIS
3128
+ <bigframes.core.indexes.index.Index object at ...>
3129
+ >>> df.index.values
3130
+ array([10, 20, 30], dtype=object)
3131
+
3132
+ Let's try setting a new index for the dataframe and see that reflect via
3133
+ ``index`` property.
3134
+
3135
+ >>> df1 = df.set_index(["Name", "Location"])
3136
+ >>> df1
3137
+ Age
3138
+ Name Location
3139
+ Alice Seattle 25
3140
+ Bob New York 30
3141
+ Aritra Kona 35
3142
+ <BLANKLINE>
3143
+ [3 rows x 1 columns]
3144
+ >>> df1.index # doctest: +ELLIPSIS
3145
+ <bigframes.core.indexes.index.Index object at ...>
3146
+ >>> df1.index.values
3147
+ array([('Alice', 'Seattle'), ('Bob', 'New York'), ('Aritra', 'Kona')],
3148
+ dtype=object)
3149
+
3109
3150
Returns:
3110
3151
The index labels of the DataFrame.
3111
3152
"""
3112
3153
raise NotImplementedError (constants .ABSTRACT_METHOD_ERROR_MESSAGE )
3113
3154
3114
3155
@property
3115
3156
def columns (self ):
3116
- "The column labels of the DataFrame."
3157
+ """The column labels of the DataFrame.
3158
+
3159
+ **Examples:**
3160
+
3161
+ >>> import bigframes.pandas as bpd
3162
+ >>> bpd.options.display.progress_bar = None
3163
+
3164
+ You can access the column labels of a DataFrame via ``columns`` property.
3165
+
3166
+ >>> df = bpd.DataFrame({'Name': ['Alice', 'Bob', 'Aritra'],
3167
+ ... 'Age': [25, 30, 35],
3168
+ ... 'Location': ['Seattle', 'New York', 'Kona']},
3169
+ ... index=([10, 20, 30]))
3170
+ >>> df
3171
+ Name Age Location
3172
+ 10 Alice 25 Seattle
3173
+ 20 Bob 30 New York
3174
+ 30 Aritra 35 Kona
3175
+ <BLANKLINE>
3176
+ [3 rows x 3 columns]
3177
+ >>> df.columns
3178
+ Index(['Name', 'Age', 'Location'], dtype='object')
3179
+
3180
+ You can also set new labels for columns.
3181
+
3182
+ >>> df.columns = ["NewName", "NewAge", "NewLocation"]
3183
+ >>> df
3184
+ NewName NewAge NewLocation
3185
+ 10 Alice 25 Seattle
3186
+ 20 Bob 30 New York
3187
+ 30 Aritra 35 Kona
3188
+ <BLANKLINE>
3189
+ [3 rows x 3 columns]
3190
+ >>> df.columns
3191
+ Index(['NewName', 'NewAge', 'NewLocation'], dtype='object')
3192
+
3193
+ """
3117
3194
raise NotImplementedError (constants .ABSTRACT_METHOD_ERROR_MESSAGE )
3118
3195
3119
3196
def value_counts (
0 commit comments