Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6169179
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T22:48:48+00:00 2026-05-23T22:48:48+00:00

I am having difficulty with this seemingly simple operation that I’d assume has been

  • 0

I am having difficulty with this seemingly simple operation that I’d assume has been solved previously but I cannot find any examples.

In the R environment @data is of type DataFrame but rpy2 (2.2) is returning a Matrix. Is there a convirent way to either convert m to a DataFrame or to have the robjects.r(query) return a DataFrame?

from rpy2.robjects.packages import importr
import rpy2.robjects as robjects

fimport = importr('fImport')

yahooImport = robjects.r('function(x) yahooImport(x)@data')
qqq = yahooImport("QQQ")

print type(qqq)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T22:48:49+00:00Added an answer on May 23, 2026 at 10:48 pm

    You can try explicitly casting to a data.frame in your yahooImport function.

    The following worked for me:

    >>> yahooImport = robjects.r('function(x) as.data.frame(yahooImport(x)@data)')
    
    >>> print type(qqq)
    <class 'rpy2.robjects.vectors.DataFrame'>
    >>> qqq
    <DataFrame - Python:0x102412680 / R:0x103c2b310>
    [Float..., Float..., Float..., Float..., Float..., Float...]
      Open: <class 'rpy2.robjects.vectors.FloatVector'>
      <FloatVector - Python:0x10241a638 / R:0x1048f1c00>
    [58.970000, 58.660000, 59.180000, ..., 102.250000, 102.870000, 102.250000]
      High: <class 'rpy2.robjects.vectors.FloatVector'>
      <FloatVector - Python:0x10241acf8 / R:0x104916000>
    [59.700000, 59.320000, 59.190000, ..., 102.310000, 103.470000, 102.310000]
      Low: <class 'rpy2.robjects.vectors.FloatVector'>
      <FloatVector - Python:0x10241add0 / R:0x10491c200>
    [58.920000, 58.340000, 58.500000, ..., 99.310000, 100.620000, 100.560000]
      Close: <class 'rpy2.robjects.vectors.FloatVector'>
      <FloatVector - Python:0x10241aef0 / R:0x10486f800>
    [59.600000, 58.990000, 58.600000, ..., 100.120000, 102.620000, 102.120000]
      Volume: <class 'rpy2.robjects.vectors.FloatVector'>
      <FloatVector - Python:0x10241d050 / R:0x104875a00>
    [43540100.000000, 70148800.000000, 57085500.000000, ..., 8743600.000000, 9688600.000000, 5232000.000000]
      Adj.Close: <class 'rpy2.robjects.vectors.FloatVector'>
      <FloatVector - Python:0x10241d170 / R:0x10485a000>
    [59.600000, 58.990000, 58.600000, ..., 48.110000, 49.320000, 49.080000]
    

    yahooImport returns a timeSeries object which is represented internally as a matrix, which is what is causing your return values in rpy2 to be a matrix.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having difficulty doing this seemingly simple task. I want to load XML files
I have been trying to tackle this problem , but I am having difficulty
I think this should be simple but I am having some difficulty implementing it.
I'm trying to use this library (which looks very nice) but I'm having difficulty
Forgive me if this is a tried question, but I'm having a little difficulty
I'm having real difficulty with this but I'm no javascript expert. All I want
I'm having some difficulty with this, but basically load a page into a QWebView
I am having difficulty to explain this problem, but I will try anyway. I
I'm having difficulty interpreting this formula that was from a past exam paper that
I've seen a few different versions of this question but having difficulty applying it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.