@@ -170,38 +170,19 @@ function Base.dotview(df::AbstractDataFrame, ::Colon, cols::ColumnIndex)
170
170
end
171
171
172
172
# df[!, cols] .= ...
173
- function Base. dotview (df:: AbstractDataFrame , :: typeof (! ), cols)
174
- if ! (cols isa ColumnIndex)
175
- return ColReplaceDataFrame (df, convert (Vector{Int}, index (df)[cols]))
176
- end
177
- if haskey (index (df), cols)
178
- _drop_all_nonnote_metadata! (parent (df))
179
- return view (df, :, cols)
180
- end
181
- if cols isa SymbolOrString
182
- if columnindex (df, cols) == 0 && ! is_column_insertion_allowed (df)
183
- throw (ArgumentError (" creating new columns in a SubDataFrame that subsets " *
184
- " columns of its parent data frame is disallowed" ))
185
- end
186
- elseif ! (1 <= cols <= ncol (df))
187
- throw (ArgumentError (" creating new columns using an integer index is disallowed" ))
188
- end
189
- return LazyNewColDataFrame (df, cols isa AbstractString ? Symbol (cols) : cols)
173
+ function Base. dotview (df:: AbstractDataFrame , :: typeof (! ), cols:: Any )
174
+ return ColReplaceDataFrame (df, convert (Vector{Int}, index (df)[cols]))
175
+ end
176
+ function Base. dotview (df:: AbstractDataFrame , :: typeof (! ), cols:: ColumnIndex )
177
+ _drop_all_nonnote_metadata! (parent (df))
178
+ return df[! , cols]
190
179
end
191
180
192
181
if isdefined (Base, :dotgetproperty ) # Introduced in Julia 1.7
193
182
# df.col .= ...
194
183
function Base. dotgetproperty (df:: AbstractDataFrame , col:: SymbolOrString )
195
- if haskey (index (df), col)
196
- _drop_all_nonnote_metadata! (parent (df))
197
- return df[! , col]
198
- end
199
-
200
- if columnindex (df, col) == 0 && ! is_column_insertion_allowed (df)
201
- throw (ArgumentError (" creating new columns in a SubDataFrame that subsets " *
202
- " columns of its parent data frame is disallowed" ))
203
- end
204
- return LazyNewColDataFrame (df, Symbol (col))
184
+ _drop_all_nonnote_metadata! (parent (df))
185
+ return df[! , col]
205
186
end
206
187
end
207
188
0 commit comments