小编Bro*_*try的帖子

Pandas相当于SQL CROSS JOIN(笛卡尔积)

假设我有两张桌子:

表格1:

   col1  col2
      0     1
      2     3
Run Code Online (Sandbox Code Playgroud)

表2:

   col3  col4
      5     6
      7     8
Run Code Online (Sandbox Code Playgroud)

在SQL中,如果我发出以下声明:

Select *
From Table1, Table2;
Run Code Online (Sandbox Code Playgroud)

我期望从两个表中获得包含所有组合的表格:

col1 col2 col3 col4
   0    1    5    6
   0    1    7    8
   2    3    5    6
   2    3    7    8
Run Code Online (Sandbox Code Playgroud)

有没有办法在pandas中使用两个数据帧做同样的事情?

python sql join pandas

7
推荐指数
1
解决办法
3074
查看次数

由于某种原因,我的D3地图正反面显示-如何翻转它?

有一个我要导入的topoJSON文件-看起来应该很容易翻转,但我不知道。创建对象或调整JSON之后,应该转换对象吗?我尝试使用一些投影,该投影使物体翻转,但整个地方变形了。

<!DOCTYPE html>
<meta charset="utf-8">
<style>

.counties {
  fill: blue;
}

.states {
  fill: none;
  stroke: #fff;
  stroke-linejoin: round;
}

</style>
<svg width="960" height="600"></svg>
<script src="https://d3js.org/d3.v4.min.js"></script>
<script src="https://d3js.org/d3-scale-chromatic.v1.min.js"></script>
<script src="https://d3js.org/topojson.v2.min.js"></script>
<script>


var svg = d3.select("svg"),
    width = +svg.attr("width"),
    height = +svg.attr("height");

var path = d3.geoPath()

 //first make projection  
  //var projection = d3.geoMercator();
  //var path = d3.geoPath()
  //  .projection(projection);



d3.json("data.topojson", function(error, us) {
  if (error) throw error;


 var counties = topojson.feature(us, us.objects.counties),
                    counties = counties.features.filter(function(d) { return d.properties.AWATER === 0; }); …
Run Code Online (Sandbox Code Playgroud)

html javascript svg d3.js topojson

3
推荐指数
1
解决办法
350
查看次数

标签 统计

d3.js ×1

html ×1

javascript ×1

join ×1

pandas ×1

python ×1

sql ×1

svg ×1

topojson ×1