Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

how change column strin of list data type to list

from ast import literal_eval
import pandas as pd

# convert the column during import
df = pd.read_csv('test.csv', converters={'col1': literal_eval})

# display(df)
                                col1
0                       [1.23, 2.34]
1  [KB4523205, KB4519569, KB4503308]

# check type
print(type(df.iloc[0, 0]))
list

print(type(df.iloc[1, 0]))
list
Comment

PREVIOUS NEXT
Code Example
Python :: python round 1 decimal place 
Python :: download images off unsplash python 
Python :: download unsplash images python no api 
Python :: flask form 
Python :: how to change int to string in python 
Python :: axios django post data 
Python :: python while 
Python :: manage python environment in jupyterlab 
Python :: append string python 
Python :: netcdf in python 
Python :: dda line drawing algorithm 
Python :: print without newline 
Python :: pandas count show one column 
Python :: activate virtual environment 
Python :: Scatter plot with regression line Python 
Python :: python get total gpu memory 
Python :: current working directory in python 
Python :: Customizable TKinter Buttons Python 
Python :: hide tkinter window 
Python :: calculate quantiles python 
Python :: python loc 
Python :: iterate over a list python 
Python :: append a dataframe to an empty dataframe 
Python :: string list to int list python 
Python :: strptime python 
Python :: python library for downsampling a photo 
Python :: make value of two tables unique django 
Python :: python isin 
Python :: pandas get highest values row 
Python :: stack details in python 
ADD CONTENT
Topic
Content
Source link
Name
5+4 =