Coder Social home page Coder Social logo

Comments (3)

Hugovdberg avatar Hugovdberg commented on August 12, 2024 1

This should work:

list(zip(data.index, data))

See this StackOverflow question: https://stackoverflow.com/a/38468711/4398595

from piconnect.

Hugovdberg avatar Hugovdberg commented on August 12, 2024

The recorded_values method returns a pandas.Series of the data, where the timestamps of the events are the index of the series.

The way you retrieve values from the series returns only the data at that location, but not its index. More information on getting subsets of pandas objects can be found on this page: Indexing and selecting data. If you would like to see the first 10 items of the data you could do this:

with PI.PIAFDatabase(server=servers[0],
                     database="Test") as database:
    element = database.descendant(
        r'Europe\A\B')
    attribute = element.attributes['DD']
    print(type(attribute))
    data = attribute.recorded_values('*-5mo', '*')
    print(data.head(10))

This is therefore not a bug in PIconnect, and I will close the issue. Feel free to comment if you think the way PIconnect returns the data is actually wrong.

from piconnect.

vadtam avatar vadtam commented on August 12, 2024

subset = data.head(10) is of type <class 'PIconnect.PIData.PISeries'>
cmd_output is as follows:
2017-01-12 15:04:47+01:00 204.395
2017-01-13 15:04:48+01:00 204.395
Name: Rate, dtype: object

How to convert them to (datetime, float) pairs? I tried several solutions from the internet, but it fails.

from piconnect.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.