python create new pandas dataframe with specific columns
# Basic syntax:
new_dataframe = old_dataframe.filter(['Columns','you','want'], axis=1)
python create new pandas dataframe with specific columns
# Basic syntax:
new_dataframe = old_dataframe.filter(['Columns','you','want'], axis=1)
get certain columns pandas with string
import pandas as pd
data = {'spike-2': [1,2,3], 'hey spke': [4,5,6], 'spiked-in': [7,8,9], 'no': [10,11,12]}
df = pd.DataFrame(data)
spike_cols = [col for col in df.columns if 'spike' in col]
print(list(df.columns))
print(spike_cols)
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us