Reputation: 64034
I have a DataFrame
that looks like this:
In [10]: import pandas as pd
In [11]: df = pd.read_table("http://dpaste.com/2M75260.txt",sep=",")
In [12]: df.head(n=3L)
Out[12]:
ID Genes Foldchange
0 1415670_at Copg 0.989
1 1415673_at Psph 1.004
2 1415674_a_at Trappc4 1.000
In actuality there are around 40K rows. What I want to do is to change the all the values in Foldchange
with same value 2
.
So that it will looks like:
ID Genes Foldchange
1415670_at Copg 2.000
1415673_at Psph 2.000
1415674_a_at Trappc4 2.000
.... etc...
How can I do that conveniently in Pandas?
Upvotes: 1
Views: 4206
Reputation: 620
I don't know pandas, but a quick search: Python pandas equivalent for replace
Since read_table returns a dataframe, you should be able to do a list comprehension or map() with the result() method.
Upvotes: -2