Skip to content
Advertisement

Tag: dataframe

How to merge rows in sql

I am trying to understand how to merge two rows (which are the same) into one. They both have data that needs to be in the same row but the raw data currently has split them into two rows. Essentially,…

Importing JSON data from SQL DB to an R dataframe

I would like to know whether there is a way of importing JSON data from a MySQL DB to an R dataframe. I have a table like this: I would like to get the columns ‘id’ and ‘json’. I am using RMySQL package for getting the data from the db to an R dataframe but this gives me only the

Pandas dataframe combine unique row values

I have a dataframe like the following with over 90000 rows. As you can see, some origin and destination values repeat for example there are multiple rows where origin=101011001, destination=101011002. My goal is to group the repeating origin and destination values and sum the the people column, so the dataframe looks like this: I’ve tried jsondf.groupby([‘origin’, ‘destination’]).sum() which gives me

SQL & Pandas Efficiency [closed]

Closed. This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 2 years ago. Improve this question Quick question. What is the rule of thumb when deciding where to begin manipulating data? Should I do it when I

Intersect two sf data.frames based on date and geometry using R

So, I have two R “sf” “data.frames”, one with millions of linestring geometries (vsr_segments: see below) and the other with 5 polygons (vsr_zones: see below). Each linestring has a datetime and each polygon has a unique date range. I’m trying to intersect the linestrings dataframe with the polygon data.frame based on whether the linestring datetime falls within a specific polygon’s

Advertisement