-1

I have a dataframe. In this dataframe, there is a element whose value is 3002-3433. I would like to remove it because it is in the wrong format. I dont know the position of this value in the dataframe. How to do this?

  • To remove a row based on column value: https://stackoverflow.com/questions/18172851/deleting-dataframe-row-in-pandas-based-on-column-value – Jeffrey Ram Sep 03 '17 at 14:48
  • If it is a string, you can [replace based on a pattern](https://pandas.pydata.org/pandas-docs/stable/text.html#splitting-and-replacing-strings) – wwii Sep 03 '17 at 14:51
  • Usually it makes it easier if you provide a minimal eaxample of the data you are operating on and if relevant, the desired result ... [mcve]. – wwii Sep 03 '17 at 14:56

1 Answers1

1

no need to remove, just create a new one:

a = [{'a':1, 'b':2},{'a':2,'b':3}]
import pandas as pd
df = pd.DataFrame(a)
df2 = df[df.a != 1]

then result is the same with the operation which remove the row when the field a is euqal to 1.

Howardyan
  • 667
  • 1
  • 6
  • 15