Python Forum
problem of converting Matlab code to python
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
problem of converting Matlab code to python
#3
Strongly recommend reading the material Dean Hystad linked to above.
Will add - best to use a pandas dataframe for your data - like a smart spreadsheet. You mentioned that you have a csv file to convert. See the method read_csv in the Pandas Documentation Here with particular attention to the usecols option to select the columns and skipfooter option to limit to the first 4000 rows. All of this should come down to something like (untested, forgive me in advance)
import pandas as pd

df = pd.read_csv("myfile.csv", delimiter=',', usecols=[1,4,5], skipfooter=28767)
df.head()
Reply


Messages In This Thread
RE: problem of converting Matlab code to python - by jefsummers - Feb-03-2023, 01:04 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Convolution "same" in Python doesn't work as Matlab claw91 4 3,873 Oct-01-2020, 08:59 AM
Last Post: claw91
  Python equivalent of Matlab code kwokmaster 5 7,177 Apr-03-2020, 12:02 AM
Last Post: scidam
  Is there similar function to lsqnonlin (in matlab) in python? Jay_Nerella 1 6,049 Nov-11-2019, 08:40 AM
Last Post: feli_x
  Matlab to Python Ariane 6 7,185 Jun-14-2018, 12:08 PM
Last Post: Ariane
  Python code optimization problem servanm 2 2,885 May-23-2018, 01:28 PM
Last Post: servanm
  How to use .m matlab file in python ? sameer 5 15,515 May-10-2018, 09:39 AM
Last Post: wavic
  Importing matlab cell array (.mat) into a python list scanato 0 8,703 Nov-15-2017, 11:04 AM
Last Post: scanato
  The problem of converting string to float by using CSV file CChen 2 13,007 Jul-11-2017, 03:32 PM
Last Post: CChen

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020