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'
------------
--
You received this message because you are subscribed to the Google Groups
"Project Jupyter" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jupyter/a798b950-0a3a-4b80-8ef7-7ba91593f893%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.