Question: Using this code I have write/replace data in an excel file. But now i need to do the same thing for csv file. Can someone help me with that?

```py
with pd.ExcelWriter('2.xlsx', mode='a', engine='openpyxl', if_sheet_exists='replace') as writer:  
    fm_data.to_excel(writer, sheet_name='Raw Data1') 

```

Answer: 
Assuming you know there are only 2 columns *and* the second column is always a floating-point number (when there are any), you can use this:

```
awk -F, 'NF == 3 { $0 = $1FS$2"."$3 } NF == 4 { $0 = $1"."$2FS$3"."$4 } 1' infile

```
You can try this sed:

```bash
cat file
30,-4,098511E-02
66,7,-1,865433
42,35,18,15199
30,05,-4,098511E-02

sed -E 's/^([0-9]*),([0-9])/\1.\2/; s/([0-9]),([0-9E-]*)$/\1.\2/' file

30,-4,098511E-02
66.7,-1.865433
42.35,18.15199
30.05,-4.098511E-02

```

Here `^([0-9]*),([0-9])` matches 2 digits at start separated by a `,` in capture groups 1 and 2. In replacement we place a dot between captured values.