Dear Jupyter users and experts,
I am new to using Jupyter notebook installed via "anaconda navigator".
For my ML needs, I need to preprocess data in CSV file i.e. remove columns with < 5% std (and remove rows for which > 50% features are zero valued etc).
I tried the std condition with the following code, but it gives the following error.
I couldn't find an easy solution in manuals and with google either.
Can you please suggest me on a possible fix for this?
thanks.
Code:
----------
import pandas as pd
import numpy as np
#df = pd.DataFrame()
with open('test.csv', 'r', encoding="ascii", errors="surrogateescape") as f:
data = f.read()
#f = pd.read_csv('test.csv')
df = pd.DataFrame(f)
# pd.std(axis=10)
rmcols = pd.drop(pd.std()[(pd.std() == 0)].index, axis=1)
rmcols.to_csv('new.csv')
-------------
Error:
-------------
AttributeError Traceback (most recent call last)
<ipython-input-22-76d08e00951a> in <module>
8
9 # pd.std(axis=10)
---> 10 rmcols = pd.drop(pd.std()[(pd.std() == 0)].index, axis=1)
11 rmcols.to_csv('new.csv')
AttributeError: module 'pandas' has no attribute 'drop'------------