0

sorry if it the wrong place to ask

I have a csv file with 12k+ rows and 2 columns[date,string] one of the columns have strings in it that most of them have 1-3 template that goes like: ["name(changes every row),fixed string, number, fixed string, number] I want that every template will split into 3 columns [name, fixed_string_1 (with the number that follows it inside), fixed_string_2 (with the number that follows it inside)] and that every new row will have the same time stamp as the row it was separated from.

with what tool is it possible to do it in python ? (and macOS)

SY5
  • 15
  • 3
  • Read the data using [pandas](https://pandas.pydata.org/). Then you can follow this SO thread to solve the string splitting problem: https://stackoverflow.com/questions/14745022/how-to-split-a-dataframe-string-column-into-two-columns – juhat Apr 13 '22 at 17:12

1 Answers1

0

You can use the pandas library in python to clean your data easily. and pandas documentation for CSV operations can be found at https://pandas.pydata.org/docs/reference/api/pandas.read_csv.html

PS. the question needs more clarification. If you can post a snippet of the csv file with various different types of rows in your CSV file then I can write a snippet of code that you can use.

  • hey, thank you for the comment this how the most line looks like: "RSRUSDT rsi is 9.44 at price 0.037430. TF - 15mins" with date column "09.10.2021 02:26:22" and I want the first columns to be ["RSR", 9.44, 0.037430, 15] but some of them looks like this "rsi alert for coins:\n\n BNB rsi is 9.98 at price 361.48. TF - 1hour\n\nADA rsi is 9.89 at price 1.0738. TF - 15mins" with date column "22.01.2022 08:28:57" - in this case I want to split it into to rows that shall have the same date as the original row had but will look like: ["BNB", 9.98, 361.48. 1] ["ADA", 9.89, 1.0738, 15] – SY5 Apr 13 '22 at 18:19