What do you want to save?
Add Code snippet
New code examples
-
Python 2022-03-21 08:45:23
python extract specific columns from pandas dataframe
# Basic syntax: new_dataframe = dataframe.filter(['col_name_1', 'col_name_2']) # Where the new_dataframe will only have the column names specified # Note, use df.filter(['names', ... ], axis=0] to select rows Add solution -
Python 2022-01-28 20:45:53
column contains substring python
df2 = df.filter(regex='spike') print(df2) Add solution -
Python 2021-11-02 04:10:12
Filters rows using the given condition
# Filters rows using the given condition df.filter(df.age > 3).collect() # [Row(age=5, name='Bob')] df.where(df.age == 2).collect() # Row(age=2, name='Alice')] df.filter("age > 3").collect() # [Row(age=5, name='Bob')] df.where("age ... Add solution
Best helpers
Cali
+5
Veirtimid
+5
Anon8889
+5
Sardathrion
+5
Nuria
+5
Tony Ong
+5
Mike Adams
+5
PoundingRain
+5
Shachna
+5
Zhengyue
+5
Kang
+5
Altexpape
+5