yhat / ggpy

ggplot port for python
http://yhat.github.io/ggpy/
BSD 2-Clause "Simplified" License
3.69k stars 573 forks source link

String with "." considered as float #632

Open sabinfos opened 6 years ago

sabinfos commented 6 years ago

Hi, I'm starting using ggplot.

When I try creating a graph based on IP adresses, I got the folowing error

ValueError: invalid literal for float(): 141.81.0.86

Any idea for solving this issue ?

Below the python script:

from ggplot import *
import pandas as pd
fileIn="MyFile.csv"
trafic=pd.read_csv(fileIn, dtype={'timestamp': object,'srcIP': object ,'dstIP': object, 'dstPort': int})
p=qplot(x= 'timestamp', y = 'srcIP', data = trafic, geom ="point")
print p

csv content:

timestamp,srcIP,dstIP,dstPort
2012-11-12 11:03:00.264365,"141.81.0.86","141.81.0.10",57184
2012-11-12 11:03:00.264400,"141.81.0.10","141.81.0.86",502
2012-11-12 11:03:00.264939,"141.81.0.86","141.81.0.10",57184
2012-11-12 11:03:00.265397,"141.81.0.10","141.81.0.86",502
2012-11-12 11:03:00.312481,"141.81.0.86","141.81.0.10",57184
2012-11-12 11:03:00.337028,"141.81.0.10","141.81.0.24",502
2012-11-12 11:03:00.337680,"141.81.0.24","141.81.0.10",64338
2012-11-12 11:03:00.347049,"141.81.0.10","141.81.0.24",502
2012-11-12 11:03:00.347112,"141.81.0.10","141.81.0.44",502
2012-11-12 11:03:00.347246,"141.81.0.10","141.81.0.104",502

I uses:

Thanks for your help. S.