我正在尝试将新数组添加到第1行之后的另一个数组中
a=np.arange(1,17).reshape(4,4)
b=np.zeros((1,4),dtype=np.uint8)
c=np.concatenate((a,b),0)
当我尝试此操作时,它将其添加到最后一行之后
[[ 1 2 3 4]
[ 5 6 7 8]
[ 9 10 11 12]
[13 14 15 16]
[ 0 0 0 0]]
我想在第1行之后添加它,所以它应该看起来像这样
[[ 1 2 3 4]
[ 5 6 7 8]
[ 0 0 0 0]
[ 9 10 11 12]
[13 14 15 16]]
答案 0 :(得分:0)
<Window x:Class="ChattBoxx.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:ChattBoxx"
mc:Ignorable="d"
Title="ChattBoxx" Icon="c:/users/jc and jf/pictures/yolo.png" Height="450" Width="641">
<Grid Name="Grid">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<!--<<< Will resize to the size of contents -->
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<!--<<< Will resize to the size of contents -->
</Grid.ColumnDefinitions>
<TextBox Name="viewMessage" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" HorizontalAlignment="Left" Margin="27,29,0,123" TextWrapping="Wrap" Text="TextBox" VerticalAlignment="Center" Height="267" Width="391"/>
<TextBox Name="Input" Keyboard.PreviewKeyDown="Input_PreviewKeyDown" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" HorizontalAlignment="Left" Margin="27,335,0,49" TextWrapping="Wrap" Text="TextBox" VerticalAlignment="Center" Width="245" Height="35"/>
<Button Name="Send" Content="Send" Click="Send_Click" HorizontalAlignment="Left" Height="31" Margin="293,337,0,0" VerticalAlignment="Top" Width="78"/>
<Menu Name="Menu" HorizontalAlignment="Left" Height="315" Margin="453,26,0,0" VerticalAlignment="Top" Width="162">
<MenuItem Name="Chatts" Header="Chatts" FontSize="32" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Height="46" Width="152"/>
<MenuItem Name="MainChat" Click="Click" Header="Main Chat" FontSize="15"></MenuItem>
</Menu>
<Button Name="new" Click="New_Click" Content="New Chat" HorizontalAlignment="Left" Height="32" Margin="498,355,0,-17" VerticalAlignment="Top" Width="82"/>
</Grid>
</Window>
块状插入(documentation)