'AttributeError: 'DataFrame' object has no attribute 'Time' after using different CSV file
I am working on this one a wile now, in the past I had no problems with the code and interactive plot at al. csv file was stored local. things that changed CSV was manualy adjusted sow without the skiprow function.. now I call the csv from a server and skip the first 5 rows . The thing is now I get an error . This is the df I load (one of them).
df1 = pd.read_csv("N:/ASS/503 Niro Soavi/Niro Soavi/NSOA Machines in Holland/Nutricia Zoetermeer/220513 BB17 Data/Measure 22030801_chn1_(Vib-Aux)_RMS.csv", skiprows=5)
Time;dB;Abs;Unit;Overflow;
17:11:03;66 88; 0 002208004; m/s^2;BO ;
17:11:04;64 72; 0 001721869; m/s^2;BO ;
17:11:05;64 75; 0 001727826; m/s^2;BO ;
17:11:06;64 84; 0 001745822; m/s^2;BO ;
17:11:07;65 07; 0 001792668; m/s^2;BO ;
... ... ...
18:05:37;65 32; 0 001845016; m/s^2;BO ;
18:05:38;65 07; 0 001792668; m/s^2;BO ;
18:05:39;69 20; 0 00288403; m/s^2;BO ;
18:05:40;78 17; 0 008100279; m/s^2;BO ;
18:05:41;74 88; 0 005546256; m/s^2;BO ;
3279 rows × 1 columns
and here the code, as you can see i try to load 4 different csv in one plot.
import chart_studio.plotly as py
from plotly.offline import iplot
import pandas as pd
import plotly.graph_objs as go
df1 = pd.read_csv("N:/ASS/503 Niro Soavi/Niro Soavi/NSOA Machines in Holland/Nutricia Zoetermeer/220513 BB17 Data/Measure 22030801_chn1_(Vib-Aux)_RMS.csv", skiprows=5)
df2 = pd.read_csv("N:/ASS/503 Niro Soavi/Niro Soavi/NSOA Machines in Holland/Nutricia Zoetermeer/220513 BB17 Data/Measure 22030801_chn2_(Vib-X)_RMS.csv", skiprows=5)
df3 = pd.read_csv("N:/ASS/503 Niro Soavi/Niro Soavi/NSOA Machines in Holland/Nutricia Zoetermeer/220513 BB17 Data/Measure 22030801_chn3_(Vib-Y)_RMS.csv", skiprows=5)
df4 = pd.read_csv("N:/ASS/503 Niro Soavi/Niro Soavi/NSOA Machines in Holland/Nutricia Zoetermeer/220513 BB17 Data/Measure 22030801_chn4_(Vib-Z)_RMS.csv", skiprows=5)
trace_one = go.Scatter(
x=df1.Time,
y=df1['dB'],
name= "ch1",
line= dict(color='forestgreen'),
opacity= 0.4)
trace_two = go.Scatter(
x=df2.Time,
y=df2['dB'],
name= "ch2",
line= dict(color='chocolate'),
opacity= 0.4)
trace_three = go.Scatter(
x=df3.Time,
y=df3['dB'],
name= "ch3",
line= dict(color='violet'),
opacity= 0.4)
trace_four = go.Scatter(
x=df4.Time,
y=df4['dB'],
name= "ch4",
line= dict(color='red'),
opacity= 0.4)
#data = [trace_one, trace_two, trace_three, trace_four]
data = [trace_one]
layout = dict(
title= 'BB17 values 220308')
fig = dict(data=data, layout=layout)
iplot(fig, filename = 'BB17outcome220308')
this is the error i am running in to
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_22328/1558647783.py in <module>
11
12 trace_one = go.Scatter(
---> 13 x=df1.Time,
14 y=df1['dB'],
15 name= "ch1",
~\Anaconda3\lib\site-packages\pandas\core\generic.py in __getattr__(self, name)
5485 ):
5486 return self[name]
-> 5487 return object.__getattribute__(self, name)
5488
5489 def __setattr__(self, name: str, value) -> None:
AttributeError: 'DataFrame' object has no attribute 'Time'
could somebody help me out and point me in the right direction?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
