Remove ends of string entries in pandas DataFrame column
<p>I have a pandas Dataframe with one column a list of files</p>

<pre><code>import pandas as pd
df = pd.read_csv('fname.csv')

df.head()

filename    A    B    C
fn1.txt   2    4    5
fn2.txt   1    2    1
fn3.txt   ....
....
</code></pre>

<p>I would like to delete the file extension <code>.txt</code> from each entry in <code>filename</code>. How do I accomplish this? </p>

<p>I tried:</p>

<pre><code>df['filename'] = df['filename'].map(lambda x: str(x)[:-4])
</code></pre>

<p>but when I look at the column entries afterwards with <code>df.head()</code>, nothing has changed. </p>

<p>How does one do this? </p>