Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

pandas dataframe froms string

import sys
if sys.version_info[0] < 3: 
    from StringIO import StringIO
else:
    from io import StringIO

import pandas as pd

TESTDATA = StringIO("""col1;col2;col3
    1;4.4;99
    2;4.5;200
    3;4.7;65
    4;3.2;140
    """)

df = pd.read_csv(TESTDATA, sep=";")
Comment

PREVIOUS NEXT
Code Example
Python :: python expressions 
Python :: flask client ip 
Python :: rmse python 
Python :: Python - How To Check if a String Is a Palindrome 
Python :: qtablewidget not editable python 
Python :: python relative file path doesnt work 
Python :: take screenshot of video python 
Python :: alpaca api python wrapper 
Python :: file.open("file.txt); 
Python :: python move a file from one folder to another 
Python :: how to add two numbers 
Python :: python list 
Python :: pygame rotate image 
Python :: selenium if statement python 
Python :: python extract zip file without directory structure 
Python :: python program to find largest number in a list 
Python :: norm in python 
Python :: python change character in string 
Python :: how do you write a function in python 
Python :: how to get the author on discord.py 
Python :: python list elements 
Python :: pandas read excel with two headers 
Python :: python path to python executable 
Python :: run django localhost server 
Python :: import file in parent directory python 
Python :: how to use cos in python 
Python :: dictionary with list as value py 
Python :: numpy random in python 
Python :: How to round to 2 decimals with Python? 
Python :: python start with 
ADD CONTENT
Topic
Content
Source link
Name
4+6 =